I'm trying to print a ticket on a thermal printer, the information that the ticket must contain is enough so the ticket has a considerable length. I'm using a PrintDocument object to print the ticket, in the PrintPage event I use a Graphics object to write all the information. When printed the ticket appears correctly, the problem is that it is not printed completely. Is there a way to indicate the size of the print and so the ticket can be printed out completely?
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = impresora;
printDocument.PrintPage += new PrintPageEventHandler(this.pr_PrintPage);
printDocument.Print();
This is the PrintPage event:
private void pr_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.PageUnit = GraphicsUnit.Millimeter;
this.gfx = e.Graphics;
this.DrawHeader();
this.DrawItems();
this.DrawTotales();
this.DrawFooter();
}
for the "Draw" methods I am using the DrawString function of the Graphics object (gfx).