Click here to Skip to main content
11,925,307 members (56,321 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
I want to save my .Net Windows Panel value in Pdf file,but when save as pdf only one panel value save as one pdf page,another page not open.i want to make more than one pdf page.
this is my code for save pdf file.

Bitmap bmp = new Bitmap(this.panelMain.Width, this.panelMain.Height);
            this.panelMain.DrawToBitmap(bmp, new Rectangle(0, 0, this.panelMain.Width, this.panelMain.Height));
            // Create new pdf document and page
            PdfDocument doc = new PdfDocument();
            PdfPage oPage = new PdfPage();
            // Add the page to the pdf document and add the captured image to it
            XGraphics xgr = XGraphics.FromPdfPage(oPage);
            xgr.DrawImage(bmp, 0, 0);
            saveFileDialog1.Filter = ("PDF File|*.pdf");
            DialogResult btnSave = saveFileDialog1.ShowDialog();
            if (btnSave.Equals(DialogResult.OK))
plz help me
Posted 5-Jul-13 0:49am
Edited 5-Jul-13 0:58am
ryanb31 5-Jul-13 8:27am
What do you mean more than one page? If the content only fits on one page what would be on the other page?
Dheerendra Dwivedi 5-Jul-13 8:38am
my content fits more than one page,but pdf generate only for one.
ryanb31 5-Jul-13 8:41am
In your code you are only adding one page.
Dheerendra Dwivedi 10-Jul-13 23:37pm
how to add more than pdf page in my code ,and where add this.
Please help me
ryanb31 11-Jul-13 7:29am
I don't know but most people use itextsharp I believe.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 5 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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