Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.


C#
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
Updated 4-Jul-13 23:58pm
v4
Comments
ZurdoDev 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.
ZurdoDev 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
ZurdoDev 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900