I have to disagree with you on this. Check printing really isn't that complicated. The only trick is getting the MICR line in the correct place.
I've done a lot of special printing over the years using PCL, PostScript, the Windows GDI, and even barcode labels on Zebra printers using ZPL. We always coded them in the native language. Once the print was designed and tested, it would run indefinitely.
Contrast this with using a forms program to do the same thing. Under the idea that users could do it themselves, other divisions used various programs. For those that needed data from our system, we had to write interfaces (involving IT again). With upgrades, those interfaces would sometimes have to be modified. Some of the companies that wrote those programs went out of business, requiring us to migrate all those documents to a new system.
One of my clients switched their labels to Bartender. It's an "enterprise" label-printing "solution." We had to write interfaces to move our SQL data into Bartender. Getting it to work-and continue working-through various updates and upgrades has taken more IT hours than the direct system we used before. Now they're locked into Bartender, and switching to something else would require a huge and costly effort.
There are benefits to learning and doing things at a low level. Once it works, it tends to keep working. You can move it to whatever system you need, and there are no ongoing fees or royalties to continue using it.
Original Message:
Sent: 10-31-2024 14:02
From: Brian Paige
Subject: PRINTing PCL commands and linefeeds
Hi Shawn!
While I'm not normally one to recommend interfaces over coding, sometimes something as complicated as a check-printing routine might be better solved without coding it yourself. You might consider purchasing a forms printing software package, designing the check (and any other forms) in that package, and then passing it the data from the main system. It's obviously a bit more complicated than that, but it is MUCH easier to design a check in a software package designed for forms. AND, later on, it's much easier to make changes (like if the CEO/CFO leave the company and you have to change the signature), or if you change banks and have to change the routing and account numbers.
Just a thought on an alternative path.
Brian
Original Message:
Sent: 10/31/2024 12:10:00 PM
From: Shawn Waldie
Subject: RE: PRINTing PCL commands and linefeeds
Thank you for the suggestions, @Peter Cheney.
This will definitely be one of those types of projects, so I'll be looking into that programmers ruler, too.
------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
Original Message:
Sent: 10-30-2024 20:30
From: Peter Cheney
Subject: PRINTing PCL commands and linefeeds
It also may help you to map out the stationary that you're trying to print on so that you can determine the column and row positions for each line item to print. Judging from the examples above, I'd guess that you're using standard 6 LPI down the page and 10 CPI across? There used to be available a thing called a "programmers ruler" which had divisions of 6LPI and 10CPI that can be used to map out the stationary and then adjust your code to print exactly where you wanted. I have one somewhere but have not used it for many years but they're extremely useful in cases such as this.
Without such a useful ruler the way I'd go about it is reset the printer, set your margins to zero, LPI to 6, CPI to 10 and then issue a series of print commands that will linefeed down the page until you get to the starting point. Then print your line items using spaces to position to the correct column. If things are slightly out then maybe adjust your margins to nudge the start down or to the right a bit. A lot of trial and error.
Cheers
Peter
------------------------------
Peter Cheney
Brisbane Qld Australia
Original Message:
Sent: 10-30-2024 19:51
From: Joe Goldthwaite
Subject: PRINTing PCL commands and linefeeds
You're welcome.
Just to clarify things, the margin commands just set the page margin. It's not positioning the cursor. After your Esc E the printer is reset and is positioned at the top corner. That includes a margin of usually .25 inches. Setting them to zero moved the *first* thing you printed up and over because the margin was no longer there.
You can position the cursor directly. The command is Esc & a ### [H or V] where ### is a number and H is for horizontal positioning and V is for vertical positioning. The default measurement is 300 dpi so ### would be inches*300.
For example, if you wanted to position the cursor three inches down and two inches over you could print this:
PRINT ESC:"&a600H":ESC:"&a900V":"Two inches over three down":
I didn't actually test that but I think it's right.
Another thing about PCL is that the command ends at the first upper case character. That means that if you're using the ESC&a command you can combine both the horizontal and vertical into one command without having to send the ESC&a every time like this:
PRINT ESC:"&a300h600V"":"One inch over two down":
It also doesn't matter what order the sub commands are in. You could print it either way:
PRINT ESC:"&a600v300H"":"One inch over two down":
Finally, are you sure you want to use PCL? I did a lot of PCL programming back in the day. The problem is that not all printers are PCL printers. Also it's more difficult to email PCL documents. PDF's work a lot better for these kinds of things and there are an almost infinite number of ways to create them.
------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
Original Message:
Sent: 10-30-2024 18:31
From: Shawn Waldie
Subject: PRINTing PCL commands and linefeeds
Though the "this line printed" string did not show up this time (maybe since it's at line '0'?), that worked.
That check number is now at the very top - exactly where I would expect it.
Thank you @Joe Goldthwaite!
------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
Original Message:
Sent: 10-30-2024 16:24
From: Joe Goldthwaite
Subject: PRINTing PCL commands and linefeeds
Hi Shawn,
SInce you're resetting the printer and sending a bunch of configuration commands, your cursor is probably still at the top left position of the page. It's probably showing up where it is because of how the default page margins are set. If you're expecting it to be a the top left printable position, look into the other page setup commands.
ESC&l0E would set the top margin to zero.
ESC&a0L would set the left margin to zero.
------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
Original Message:
Sent: 10-30-2024 16:11
From: Shawn Waldie
Subject: PRINTing PCL commands and linefeeds
I should note that i'm on Unidata.
And I don't think that is working for me.
Here's the code I'm using:
And here's the result.
Using the two invoice items for comparison, it looks like like my "this line printed" is on the fourth line from the top of the page.
------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
Original Message:
Sent: 10-29-2024 22:04
From: Shawn Waldie
Subject: PRINTing PCL commands and linefeeds
I'm almost certain that linefeeds are resulting from something as simple as PRINT CHAR(27):"E"
Is there a way to do this without causing a linefeed?
------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------