Click here to Skip to main content
14,334,145 members
Rate this:
Please Sign up or sign in to vote.
So now I'm stuck with Rich text box content not visible (readable) on print page (or print preview)
I'm using to draw a table that I'm using to organize items and the rich text box should be one of the items stacked in the table (at the far end of each cell)
On the print preview, the rich text box borders are drawn but with no content inside and I tried lots of codes and sample but with no luck.

What I have tried:

private void Doc_PrintPage(object sender, PrintPageEventArgs e)
    e.Graphics.SmoothingMode =
    e.Graphics.TextRenderingHint =
    e.Graphics.InterpolationMode =
    float x = e.MarginBounds.Left;
    float y = e.MarginBounds.Top;
// Panel1 is the name of the panel that the table rest in
    Bitmap bmp = new Bitmap(this.panel1.Width, this.panel1.Height);
    this.panel1.DrawToBitmap(bmp, new Rectangle(0, 0, this.panel1.Width, this.panel1.Height));
    e.Graphics.DrawImage((Image)bmp, x, y);

private void PrintPreview_Click(object sender, EventArgs e)
            PrintDocument doc = new PrintDocument();
            doc.PrintPage += this.Doc_PrintPage;
            Margins margins = new Margins(20, 20, 20, 10);
            doc.DefaultPageSettings.Margins = margins;
            printPreviewDialog1.Document = doc;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100