The setupstring prior to macOS 26 is not read now

My app saves PrinterSetup.SetupString (now Settings) for reuse in printing, and it’s worked for many years.

Since macOS 26, the SetupString is incorrectly read, and the ShowPageSetupDialog dialog appears but is blank; the only visible information is the portrait/landscape orientation.

Has anyone ever seen this before?

Thanks

how do you save it?
You can’t assume anything about the content, so treat it as binary data.
If one byte changes or is modified, the data cut, it won’t work.

How do you save / restore the Settings ?

A simple project is welcome if you want some advised help.

Marc’s project is 8Sens, a huge french accounting app (and sub apps)
so he may not have a “simple” project to upload here !

He can certainly make a demo app of just how he is using printer Settings and zip and upload it here

1 Like


This is the contents of settings as seen in the Debugger.

As you can see, its Encoding is Nil, and it holds a mix of text and binary data.

As Christian wrote, you have to save / open as Binary. A set of .Write / .ReadAll is what have to be done.
Share just the save / restore settings if you prefer.

Indeed, I read and write it in binary.

Save:

dim lg As Integer
lg = LenB(SetupString)
thebs.WriteInt32 lg
if lg > 0 then
thebs.Write SetupString
end

Get:

lg = thebs.ReadInt32
SetupString = thebs.Read(lg)

Thank you for your replies, and hello Jean-Yves!

1 Like

Check the BinaryStream entry in the Documentation…

Use Write / Read instead of saving a defined length / load a defined length data…
Look under Open(file As FolderItem, readwrite As Boolean = False) As BinaryStream

for the example / and look same for Write…

Yes, but it’s very old code (20+ years old) that has always worked. I’m happy to switch to a newer version of my app now, but I still need to reread all the print templates saved with this setupstring!