Print 1/3 of a page w/Dot Matrix printer
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Print 1/3 of a page w/Dot Matrix printer

  1. #1
    Join Date
    May 2005
    Posts
    26

    Unhappy Print 1/3 of a page w/Dot Matrix printer

    Hi All!

    I have written many apps which print forms, textboxes,etc., but his latest app has me bouncing off the walls. I have an automated ticket generator for a truck scale. Imagine this: an Okidata Dot Matrix printer, which feedsthe paper via carriage wheel. Each 8.5 x 11 carbon-copy paper is actually divided into three carbon-copy tickets separated by perforations.

    My problem is this: I have drawn a form which fits on each ticket(1/3 of the page) quite well. However, I cannot figure out how to make the printer feed ONLY 1/3 OF THE PAGE after each spool. What ends up happening is a whole page is fed in, and two tickets are wasted each print. Of course, I could just tell the guy to feed the paper backout after every ticket, but then he would have to worry about lining it up correctly every time.

    If anyone has any ideas, I would really appreciate it
    Thanks For Your Tiime

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Print 1/3 of a page w/Dot Matrix printer

    What I would probably do in such a case is to use the printer's Escape codes to control printing, and send ASCII text. You can send it graphics, but that's quite a bit more work.

    If you have the codes, or if you know what printers it emulates, you should be able to do it. I have usually ended up using the codes from an Epson LQ series, which is supported by many brands.

    Here is an example:
    Code:
    Open "LPT1:" For Output Access Write As #1
      Print #1, Chr(27); Chr(64); 'reset
      Print #1, Chr(27); Chr(107); Chr(3); 'font
      Print #1, Chr(27); Chr(77); 'pitch 12
      Print #1, Chr(27); Chr(120); Chr(1); 'letter quality
      Print #1, "Hello World"
    Close #1
    This will simply leave the paper where it stops printing. There are codes to move the paper up and down if you need to, so as long as you know the height of what you are printing, you can make sure each begins at the proper position.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,959

    Re: Print 1/3 of a page w/Dot Matrix printer

    Another thought:

    If you are using Printer.EndDoc, that will force an eject. You would have to manually wait until you had 3 tickets.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center