Article
Clark Matthews · Nov 3, 2016 4m read

Resolving Caché Printer Problems in Windows

Problem:

Caché prints to printers in a manner somewhat different from other Windows applications.  Caché sends the data directly to the GDI Printer, without the usual interface.  This is because the GUI interface can only be shown on a system desktop session and not in web browser and terminal sessions.  Some printer drivers have problems with this method of printing.

Is this the problem you are having?

  • If you are opening the printer as a Windows printer as described in the documentation (found here).
  • … And if after you open the printer in Caché you see the job in the Windows Print Management snap-in.
  • … And if you can write data to the printer without error.
  • … And if the document simply "disappears" from the Windows Print Management snap-in when you close the printer in Caché.

   Then this addresses your problem.

There are two likely causes:

  1. The printer is not receiving more than a single page of data to print and it requires that the form be ended.This is simple to test for.Issue a "" to the printer before closing, and if you get output then this is your problem.If this solves the problem then you can add this to your code, or you may be able to change the print processor data type to add it for you. To do this you can follow the Windows-7 or Windows-10 instructions, and also read Introduction to Print Processors which discusses print processors in Windows.
  2. The printer driver/processor cannot handle TEXT data, either by default or at all.The first thing to do here is test to see if you can specify TEXT data, for example:

USER>s Dev="|PRN|Canon MX920 series Printer"
USER>o Dev:(/DATATYPE="TEXT"):30 w:'$T $SYSTEM.Process.OSError()
USER>u Dev w "Hello World!",#  ; Note # for form feed.
USER>c Dev

If this fails after 30 seconds you will see the value of $SYSTEM.Process.OSError(), which should contain the failure reason for the OPEN.  For example:

USER>s Dev="|PRN|No Such Zebra Printer"
USER>o Dev:(/DATATYPE="TEXT"):30 w:'$T $SYSTEM.Process.OSError()
<1801> The printer name is invalid.

If the open works either add '/DATATYPE="TEXT" to your OPEN command, or you may be able to set TEXT as the default data type for the printer.  To do this you can follow the Windows-7 or Windows-10 instructions, and also read Introduction to Print Processors which discusses print processors in Windows.

If these steps fail you should try updating the driver for the device from the manufacturer of the printer.

If that also fails, or if you would prefer not to modify the printer because it is used by other software than Caché, you can set up a second spool to the same physical printer for use by Caché and experiment with some of the Default drivers that come with Windows, like the “Generic / Test only” driver.  Depending on the actual printer you need to figure out what is most likely to work.  To do this first add a second instance of the printer.  This process can vary depending on your system and the type of printer you are adding.

Once the new instance of the printer is added you can rename it to something that makes it clear it is for Caché.  Then follow the Windows-7 or Windows-10 instructions to change the printer driver.  Note that not all drivers work with all printers, so this can be a matter of experimentation.  Many people have had luck using the “Generic” / “”Generic / Text Only” printer driver.  You can also try other drivers for the printer you have.

Windows 7:

  • On the printer server go to Windows Start.
  • Choose “Devices and printers”.
  • For the printer you are working on, alternate (right) click and choose “Printer properties”, not “Properties” and another window should come up.Note that this window will vary depending on the printer, so the following is what the window usually looks like.
  • Select the “Advanced” tab.
  • To change to the print processor press [Print Processor…] button:
    • To change the print processor data type:
    • To change the print processor data type, in the right-had box (“Default data type:”) you can select an “[FF appended]” (which will always append a form-feed to the end of the job), or “[FF auto]” (which will attempt to determine if a form-feed is needed) version of the current data type if it is available.
    • You can also change the print processor if you need to.Note that now all print processors work with all printers.
  • To change the printer driver press the [New Driver…] button that is after the current driver’s name.This will start the “Add Printer Driver Wizard” that walks you through the steps of adding a new driver.

Windows 10:

  • On the printer server go to Windows Start.
  • Choose “Settings”.
  • Click the printer you are working on, and choose “Manage”.
  • Select “Printer properties” and another window should come up.Note that this window will vary depending on the printer, so the following is what the window usually looks like.
  • Select the “Advanced” tab.
  • To change to the print processor press [Print Processor…] button:
    • To change the print processor data type:
    • To change the print processor data type, in the right-had box (“Default data type:”) you can select an “[FF appended]” (which will always append a form-feed to the end of the job), or “[FF auto]” (which will attempt to determine if a form-feed is needed) version of the current data type if it is available.
    • You can also change the print processor if you need to.Note that now all print processors work with all printers.
  • To change the printer driver press the [New Driver…] button that is after the current driver’s name.This will start the “Add Printer Driver Wizard” that walks you through the steps of adding a new driver.
4
2 2,406
Discussion (3)8
Log in or sign up to continue

Great post, Clark. 

Is there a particular pattern that the "Generic" printer drivers for windows follow that seems to make them work for more people? Is there a place where that is stored on Windows 7 or XP where I could read through the actual code it runs? 

Jonathan,

   I am not sure I understand the question, but I will try.

   The "Generic" driver comes from Microsoft, many other drivers come from the printer manufacturer.  After Caché put the job into the spooler, Windows uses the driver to communicate the job to the printer.  I have simply found through experience that the "Generic" driver works for Caché when the more advanced drivers do not because they do not support text output.  If this is a driver question perhaps it should be directed at the author of the driver, I do not have sources for the many printer drivers out there.

Clark

I found something called GDI Print API at Microsoft that discusses in detail the GDI printer interface.  This is what we use to send RAW/TEXT data to the printer.