0

hallo,
I want to create a print preview for an invoice. What I'm having problems with is, most of the content in the print preview is pulled from a database and not the form, I am not sure how to implement this into the code, plus how would I change the font size, color, position...

private void preview_btn_Click(object sender, EventArgs e)
        {
            ThePrintDocument.PrintPage += 
                new System.Drawing.Printing.PrintPageEventHandler(PrintPage);
            string strText = "test" // HOW CAN I ADD FROM DB
            myStringReader = new System.IO.StringReader(strText);
            PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
            printPreviewDialog1.Width = 1100;
            printPreviewDialog1.Height = 900;
            printPreviewDialog1.Document = this.ThePrintDocument;
            printPreviewDialog1.ShowDialog();
        }
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by PierlucSS
0

the easier solution would be to use a WebBrowser and use it's documenttext property.

You can then use the ie's print preview and print functionnalities. If you one to have a nice html formatting. You could use xml + xslt or HtmlAgilityPack (http://htmlagilitypack.codeplex.com/)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.