My apps do label printing under Windows OS the usual way, i.e.
g = PrinterSetup.OpenPrinter(MySetupString)
and then g.DrawText or g.DrawPicture.
This works fine for Dymo LabelWriters and for Jadens printers.
The Jadens has insufficient resolution, however, and Dymos without DRM are expensive and becoming rare, so I want to use a 300DPI Comer CX418HD.
After installing the manufacturer’s driver I can successfully print a test page to the Comer using the Windows control panel, but when I try to print from my Xojo apps (after having done Page Setup to initialize my setup string) nothing at all happens. The code executes, OpenPrinter returns a Graphics object, but the printer makes no indication of having received any data when I call DrawPicture or DrawText.
Wild shot in the dark. Some printers require a the connection to be closed before they start printing anything, that or a new page instruction. This is even more the case with label printers.
I don’t think so - I can examine the contents of the picture and strings being written to the Graphics object. Plus I can change to a Dymo or Jadens printer on the fly and send them the same data and they work.
When I print using PrinterSetup.ShowPrinterDialog it works, so apparently something’s wrong/missing with the SetupString I’m getting from PageSetup alone.
A PrinterSetup populated by ShowPageSetupDialog for this printer always has width and height of 0 (unless I set margins, in which case they’re negative). I assume that’s why it doesn’t print if I just use setup strings from the PageSetup dialog.
A PrinterSetup populated by ShowPrinterDialog has width and height set to sensible values, e.g. 162 x 90, and it prints fine when I go through this dialog.
I think this is a driver issue and since width and height are read-only I don’t think I can use this printer because I don’t want operators to have to go through a dialog for every label.
Logically there must be a way, otherwise the print job would simply accumulate forever. It would seem you have to let the printer object go out of context and be destroyed.
As for your other issue, it is fixed by using API1 or API2 alternatives?
What I’ve done in the past is communicate with the printers through their API if there is one to do the printing. Many of these label printers will accept a 300dpi BMP or TIFF file and they’re easy enough to create in Xojo.