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(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)