Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing on roll paper

Tags:

I am using C# with Winforms. I am trying to print bills on a paper roll. The width of the paper is 3in but the length of the paper is dynamic (its a roll paper). The length depends on how many items are there in the list. E.g. in a purchase if there are 100 items sold then it will be quite long roll while for a single item purchased it would be of small length.

When I print the report, after the end job, printer eject the last page more than I need. It eject paper as long as A4 size. I want to print the required lines, then stop printing. I use a roll of paper, not A4 or A3 and an Epson LQ-300 + II printer.

To be more specific, printing is always done to page-sized units. If I set the page to be 3in x 8in then I always end up with a printout that is a multiple of 8in long. If I have a 9in bill to print, I end up with a 16in printout, wasting 7in of paper. How can I print with the last page being only as long as it needs to be?

Here is the code:

private void printDoc_PrintPage(Object sender, PrintPageEventArgs e)         {             Font printFont = new Font("Courier New", 12);             int y = 15;             e.Graphics.DrawString("a Line", printFont, Brushes.Black, 0, y); y = y + 20;             e.Graphics.DrawString(" Line", printFont, Brushes.Black, 0, y); y = y + 25;             e.Graphics.DrawString(" Line", printFont, Brushes.Black, 0, y); y = y + 35;             e.Graphics.DrawString(" Line", printFont, Brushes.Black, 0, y); y = y + 45;         } 
like image 213
Thunder Avatar asked Dec 06 '10 10:12

Thunder


People also ask

Can you print on regular paper?

It should be safe to put any “paper” based material in a laser printer. You will want to stick with standard paper sizes (letter, legal, etc…)

How do I use the paper roll on my Epson printer?

To load the roll paper, lightly hold the paper in place while you press the load/eject button. The paper feeds into the printer. Note: You must hold the paper edge in place with your hand while you press the load/eject button to make sure the paper feeds correctly.

How do you print continuous paper?

Turn the printer off; then remove the printer cover and the paper guide. Next, remove the paper tension unit by squeezing the paper tension unit's lock tabs gently and pulling the paper tension unit away from the printer. Finally, pull the paper release lever forward to the continuous paper position.

Which paper type is best for printing?

A4 paper is the most commonly-used for printing and measures 210mm x 297mm. This paper comes in many different weights and with several different coatings, meaning there is an A4 paper that is suitable for any printing job.


2 Answers

Have you tried using a page that is only "one line" long?

Omit the upper and lower border, and you can print non stop.

Now add a bit (So the page can be torn off) and eject that.

Try this:

            PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);              printDoc.DefaultPageSettings.PaperSize = pkCustomSize1 

See: http://msdn.microsoft.com/en-us/library/system.drawing.printing.pagesettings.papersize.aspx

like image 185
Heiko Hatzfeld Avatar answered Oct 01 '22 16:10

Heiko Hatzfeld


You can also adjust the paper size on the fly. Less work to do it one line per page, but I'd imagine this would produce a nicer print preview if anyone were to have cause to do that:

printdoc.DefaultPageSettings.PaperSize.Height += lineheight; 
like image 43
Kevin Stricker Avatar answered Oct 01 '22 16:10

Kevin Stricker