Greetings,
I wrote a small app that prints cheques, now because i have several issues with those reports and i did not manage it to use it properly i did all via the graphics method and printed on exact locations.
Now, the issue is the following .
I have several printers that we use and i have a cheque laser printer that is dedicated for that , it has a front loader specially for this.
I need to be able to do the Initial setup, setting the paper size, paper orientation, printer and then save those in the app settings and each time i press print , the app should select the proper printer and fill the cheque .
Currently i did a partial setup by doing the printer setup and saving the page settings on a desktop file and then on the app open i check if that file exists then i load the page settings , otherwise i ask the user to do the printer setup.
This works some times and some times not
I do something like that :
printer = New PrinterSetup
If printer.ShowPageSetupDialog Then
pageSettings = EncodeHex(printer.Settings)
If pageSettingsFile <> Nil And pageSettingsFile.Exists = False Then
Var tos As TextOutputStream
tos = TextOutputStream.Create(pageSettingsFile)
tos.Write(pageSettings)
tos.Close
End If
End If
then on the print button i use this
Var g As Graphics
If printer <> Nil Then
printer.Settings = DecodeHex(pageSettings)
g = printer.ShowPrinterDialog
'and the rest of the code to print
One more thing, apparently i setup the coordinates for Windows and it prints perfectly, when i use same code, same printer on MacOS it shifts all the lines down with several lines.
Here , it loads the printer settings from the pageSettings property and then it asks me to select the printer on which i want to print.
on the initial setup it seems that it chooses some default system printer settings then i save all, and on the printing step it seems that once i select the printer it loads the settings properly as long as the app is open as it takes them from that property, then once i close the app and i reopen it, it looses all the settings despite having all the printer settings loaded from the file and i need to set them up again and select the printer and print.
So is there a way to do the setup, save all, then just press print and prints directly without selecting any printer ?
If yes, then how do i do that on MacOS and on Windows.
Thanks again.