Highlighted
Absent Member.
Absent Member.
568 views

[archive] code sample for W2 form

[Migrated content. Thread originally posted on 25 November 2004]

I was wondering if anyone out there has sample code of formatting a W2 form, either the 2-up preprinted form, or the 4 up form that prints on blank paper. I am inexperienced using the Win$printer capabilities of columns, fonts, ete, but I see where this would be great for a form like this, if the programmer gave the operator ability to shift the form slightly for better alignment.
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] code sample for W2 form

I have no experiences with the W2 form in particular. But in general I would say, filling a preprinted form is best done on a individual field by field basis.
To accomplish this, you should use the WINPRINT-SET-CURSOR opcode with absolute coordinates in inches. This will ensure your print comes at the same position regardless of the printer you use.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] code sample for W2 form

I have been trying to print on a form, the new 941, and I am trying to use the WPRTUNITS-CENTIMETERS-ABS to make sure that the text prints the same on all printers. However, when I execute the following code on different printers, my text ends up printing in different locations. Its generally only off about 1 character, on some printers its higher and others is over to the right and others is down 1 and over to the left.


INITIALIZE WPRTDATA-DRAW.
MOVE 5 TO WPRTDATA-DRAW-START-X.
MOVE 5 TO WPRTDATA-DRAW-START-Y.
MOVE WPRTUNITS-CENTIMETERS-ABS TO WPRTDATA-DRAW-DNITS
CALL "WIN$PRINTER" USING WINPRINT-SET-CURSOR WINPRINT-DATA GIVING
PR-CALL-RESULT
MOVE EIN-1 TO PRINT-REC
WRITE PRINT-REC BEFORE ADVANCING 0 LINES

I have printed on an Hp2100(pcl6), Hp2420(pcl6), Hp 6p(pcl5) and Hp4600(pcl6) and my text is in different locations on each of these printers.

I'm setting the font WPRTFONT-COURIER-12-COMP and using version 6.1.0 of the runtime.

Does anybody have any ideas why this would be?

Thanks,

scott
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] code sample for W2 form

This sounds weird. As you apparently have this reproduced at small scale I'd suggest you report it to Tech Supp.
The problem here of course is to be able to reproduce on multiple printers as do you, but as it seems quite consistent, I woul believe this should be possible.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.