2
Answers

Printing more than one page

patrick

patrick

15y
6.1k
1
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)