Click here to Skip to main content
Rate this: bad
good
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
            doc.Pages.Add(oPage);
            XGraphics xgr = XGraphics.FromPdfPage(oPage);
 
            xgr.DrawImage(bmp, 0, 0);
 
            saveFileDialog1.Filter = ("PDF File|*.pdf");
            DialogResult btnSave = saveFileDialog1.ShowDialog();
            if (btnSave.Equals(DialogResult.OK))
            {
                doc.Save(saveFileDialog1.FileName);
                doc.Close();
            }
plz help me
Posted 5-Jul-13 0:49am
Edited 5-Jul-13 0:58am
(no name)10.7K
v4
Comments
ryanb31 at 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 at 5-Jul-13 8:38am
   
my content fits more than one page,but pdf generate only for one.
ryanb31 at 5-Jul-13 8:41am
   
In your code you are only adding one page.
Dheerendra Dwivedi at 10-Jul-13 23:37pm
   
how to add more than pdf page in my code ,and where add this.
Please help me
ryanb31 at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 5 Jul 2013
Copyright © CodeProject, 1999-2014
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