PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

XGraphics.Graphics to PDF
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2214
Page 1 of 1

Author:  kabani [ Tue Nov 06, 2012 11:24 pm ]
Post subject:  XGraphics.Graphics to PDF

Dears,
I am using PDFSharp, version 1.32, GDI+ build.
I have a C# application which uses System.Drawing.Graphics to draw various graphics on GDI.
The Graphics is from a PrintPageEventArgs event e, so it is e.Graphics.
Now I would like to do the drawings on PDF, so here is what I have come up with so far:

string filename = String.Format("{0}_tempfile.pdf", Guid.NewGuid().ToString("D").ToUpper());
PdfDocument s_document = new PdfDocument();
PdfPage page = new PdfPage();
page = s_document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
//gfx.Graphics.xxxxx methods are used here to draw
//????????????? Need help here!
s_document.Save(filename);
Process.Start(filename);

I use gfx.Graphics to access all the routines that are used currently in GDI+, no problem so far.
So here is the question:
How do I put those drawings on the PDF page. I could not find any examples or guidelines online.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/