Trying to put text INFRONT of a document Im about to send to printPreview?

77 views Asked by At

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

There are 1 answers

1
Md. Rashim Uddin On

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