0

I try to put text on a document Im about to send to PrintPreview using the event PrintPageEventHandler. With this code:

 System.Drawing.Printing += new System.Drawing.Printing.PrintPageEventHandler(PrintDocument_PrintPage);

Then I use the code:

void PrintDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
        e.Graphics.DrawString("Hawkeye", new Font("Arial", 80, FontStyle.Bold), Brushes.Black, 0, 0); 
    }

When doing that the text ends upp BEHIND the document. I gues its because the event triggers before System.Printing is painting the rest of the document on the printing area. Anyone have any suggestion how to do if I want the text infront of the printable document?

1 Answers1

0

I guess you need to set HasMorePages is false as this is your last/only page. this is something like that

e.HasMorePages=false

Please follow this Link

Md. Rashim Uddin
  • 492
  • 1
  • 6
  • 15
  • I did like this instead: `e.HasMorePages = false; e.Graphics.DrawString("SampleText", new Font("Arial", 80, FontStyle.Bold), Brushes.Black, 0, 0);` But it didnt help! – Mikael Snoddas Johansson Nov 03 '11 at 14:32