Can't print to Comer brand printer

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.

Why he no work?

Any chance you’re printing a blank page? Some printers are smart enough to ignore your print request if nothing would actually be printed.

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.

How do you close a printer connection? I only see PrinterSetup.OpenPrinter as Graphics.

I can print a test page from Windows Control Panel (which feeds a label), but still nothing when I try from my app immediately thereafter.

The Windows Properties dialog shows a lot more options than the Page Setup Xojo displays, maybe my setup string is missing some info?

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.

Ain’t nobody got time for that. The Comer is going back to Amazon and I’ll try a Brother next.

But sure, if one was married to a printer and had access to its API then this is a good suggestion, thanks.

1 Like