Skip to main content

How can I print on Custom Forms without depending on a particular printer?

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

How can I print on Custom Forms without depending on a particular printer?

Resolution:

Each printer starts printing at a different physical position on the paper. This can cause issues when using a Custom Form and different printers. The program must take the physical offset  into account when you calculate the X/Y positions.

There is a way for an RM/Cobol program to print to an X/Y Position and allow for this physical offset. First, use P$GetDeviceCapabilities to retrieve the physical offset value for the printer. Then use P$TextOut instead of the Cobol WRITE statement to print text.

Attached is an example program. The P$GetDeviceCapabilities call returns values in pixels. You must convert those pixels to inches, if you prefer inches (you have a choice). The example program does the math in inches.

There is another example program in the samples folder of the RM/Cobol Development system called PDEVICE.CBL. You can compile this and run it to see the values of a particular printer.

    

Attachments:

pform.zip

Old KB# 4691