Skip to main content

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
------------------------------

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
------------------------------

Hi @Shawn Waldie

As per the UV BASIC doco on the PRINT command:

Expressions separated by colons are concatenated. That is, the
expression following the colon is printed immediately after the
expression preceding the colon. To print a list without a
LINEFEED and RETURN, end print.list with a colon (:).

Just add a trailing colon to the statement:  PRINT CHAR(27):"E":



------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------

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
------------------------------

Append a colon  i.e. PRINT CHAR(027):"E":



------------------------------
Dale Kelley
I'm it!
Dale W Kelley Inc
Hohenwald TN US
------------------------------

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
------------------------------

Thank @Gregor Scott and @Dale Kelley.
I'll give that a try and report back.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

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
------------------------------

Since this is for check printing, fortunately, we won't have to be concerned with potential email issues.

This should get me through to the next hurdle, which will be the MICR line.

Very helpful. Thanks again, @Joe Goldthwaite.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------


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
------------------------------

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
------------------------------

Since this is for check printing, fortunately, we won't have to be concerned with potential email issues.

This should get me through to the next hurdle, which will be the MICR line.

Very helpful. Thanks again, @Joe Goldthwaite.



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------

I thought I was going to be able to help you out on that.  I've written check printing programs that print directly from Pick. Sadly that program didn't print the MICR line. We must have been using pre-printed checks that already had the MICR line on it. It did print the signature by putting the printer into plotter mode and sending the drawing commands.

Later I wrote a printing program in VB that did print the MICR line.  It used the VB printer object which is scaled in twips. Twips are 1440 pixels/inch so you'd have to adjust them for your printer. The program I wrote had an adjustment number that was passed into the main routine. The number adjusted the left and top margins to get the check position correct for whatever printer they were using.

This is the routine that printed it. I change the routing and transit numbers to zeros for obvious reasons:

Private Sub PrintMicr()
         
   Dim strMicrLine As String
   Dim strCheckNum As String
   
   strCheckNum = Space(12)
      
   With Printer

     .ForeColor = &H282828 '40 Set 3 '2003-09-09 M&I tested this color to be the
                                     'darkest that wasn't too dark.  Sets four and five also
                                     'passed testing
      .Font = "Micr"
      .FontBold = False
      .FontSize = 9
      
      RSet strCheckNum = "/" & mCheck.CheckNum & "/"
      strMicrLine = strCheckNum & " &000000000& 000000000/"
      
     .CurrentY = 15040
     .CurrentX = 1316
      Printer.Print strMicrLine
     
     .ForeColor = 0  'set back to black
   
    End With
   
End Sub

You need to have a MICR font selected and a magnetic toner cartridge for your printer. The "/"  and "&" used to be the start and stop characters. Those funny ones on the MICR line.  I tried testing it to make sure they worked and... they didn't. It seems that with Unicode now. you might need to use U+2446 (⑆) and U+2445 (⑅). Using "/" and "&" will probably still work on the printer, I don't know. You'll have to test it.

I downloaded a MICR font from here.

You're supposed to be able to download TTF fonts to the printers now. They didn't exist back when I was doing this so I don't know how you would go about it. It looks complicated. I think we originally had a MICR font cartridge. 



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

I thought I was going to be able to help you out on that.  I've written check printing programs that print directly from Pick. Sadly that program didn't print the MICR line. We must have been using pre-printed checks that already had the MICR line on it. It did print the signature by putting the printer into plotter mode and sending the drawing commands.

Later I wrote a printing program in VB that did print the MICR line.  It used the VB printer object which is scaled in twips. Twips are 1440 pixels/inch so you'd have to adjust them for your printer. The program I wrote had an adjustment number that was passed into the main routine. The number adjusted the left and top margins to get the check position correct for whatever printer they were using.

This is the routine that printed it. I change the routing and transit numbers to zeros for obvious reasons:

Private Sub PrintMicr()
         
   Dim strMicrLine As String
   Dim strCheckNum As String
   
   strCheckNum = Space(12)
      
   With Printer

     .ForeColor = &H282828 '40 Set 3 '2003-09-09 M&I tested this color to be the
                                     'darkest that wasn't too dark.  Sets four and five also
                                     'passed testing
      .Font = "Micr"
      .FontBold = False
      .FontSize = 9
      
      RSet strCheckNum = "/" & mCheck.CheckNum & "/"
      strMicrLine = strCheckNum & " &000000000& 000000000/"
      
     .CurrentY = 15040
     .CurrentX = 1316
      Printer.Print strMicrLine
     
     .ForeColor = 0  'set back to black
   
    End With
   
End Sub

You need to have a MICR font selected and a magnetic toner cartridge for your printer. The "/"  and "&" used to be the start and stop characters. Those funny ones on the MICR line.  I tried testing it to make sure they worked and... they didn't. It seems that with Unicode now. you might need to use U+2446 (⑆) and U+2445 (⑅). Using "/" and "&" will probably still work on the printer, I don't know. You'll have to test it.

I downloaded a MICR font from here.

You're supposed to be able to download TTF fonts to the printers now. They didn't exist back when I was doing this so I don't know how you would go about it. It looks complicated. I think we originally had a MICR font cartridge. 



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

I'm not sure if the Unicode characters were correct.  These should be:

  • Transit (Routing) Symbol: Unicode U+2446 (⑆)
  • Amount Symbol: Unicode U+2447 (⑇)
  • On-Us Symbol: Unicode U+2448 (⑈)
  • Dash Symbol: Unicode U+2449 (⑉)

One issue I ran into is that there was no standard for mapping ASCII characters to the special MICR symbols. It could vary by font set so you'll have to test it with whatever MICR font you use.



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

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
------------------------------
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

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

Hi Brian,

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.



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

I'm not sure if the Unicode characters were correct.  These should be:

  • Transit (Routing) Symbol: Unicode U+2446 (⑆)
  • Amount Symbol: Unicode U+2447 (⑇)
  • On-Us Symbol: Unicode U+2448 (⑈)
  • Dash Symbol: Unicode U+2449 (⑉)

One issue I ran into is that there was no standard for mapping ASCII characters to the special MICR symbols. It could vary by font set so you'll have to test it with whatever MICR font you use.



------------------------------
Joe Goldthwaite
Consultant
Phoenix AZ US
------------------------------

I may need that. Thank you.

We'll be using a dedicated printer (HP/TROY), and some preliminary testing looks promising:

 



------------------------------
Shawn Waldie
enterprise application developer
Rocket Forum Shared Account
Los Angeles CA US
------------------------------