patrick

patrick

  • NA
  • 397
  • 0

Printing more than one page

Sep 11 2009 10:46 AM
I currently use the code:
private void Print()
{
string PrinterName =

PrintLocationDataHandler.getPrinterName("Reports");
PrintDocument PD = new PrintDocument
();

PD.PrinterSettings.PrinterName = PrinterName;
PD.PrintPage += new
PrintPageEventHandler(PD_PrintPage);
PD.Print();
}

void PD_PrintPage(object sender, PrintPageEventArgs e)
{

String textToPrint = richTextBox1.Text;

Font printFont = new Font("Courier New", 12, FontStyle.Bold);

e.Graphics.DrawString(textToPrint, printFont, Brushes.Black, 0, 0);

}

private void button1_Click(object sender, EventArgs e) {
Print();
}

The problem i am running into is that when it hits a new page, it just stops. I assumed the printer would automatically know when to start a new page, but it doesnt. I am printing directly from a rich text box.

Answers (2)