Print on continuous paper using c#

2019-01-27 23:25发布

问题:

I write a one POS system. I want to print on continuous paper but I don't figure out how I can accomplish this.

I use the .net (C#). I try with crystal report as well as System.drawing classes.

Any idea will be helpful for me...

回答1:

If you're using a C# PrintDocument to generate your print job, could you just initialize the paper size to what you need for header/footer then increment the PageHeight property before you draw a new line?

printdoc.DefaultPageSettings.PaperSize.Height += lineheight;


回答2:

I think you have three options: 1) You can precalculate the pagesize before printing 2) While you're printing the items check the Y position and compare it to the maximum Y position for items. If it's greater than maximum, print footer and ajust the Y positions for the un printed items. 3) Design an invisible box for each items and calculate how many of them fit in a page. Then you just need to divide the items in pages.

I hope my English is good enough.