PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
system.drawing.graphics shared code https://forum.pdfsharp.net/viewtopic.php?f=2&t=2272 |
Page 1 of 1 |
Author: | sqlpaul [ Mon Dec 17, 2012 11:24 pm ] |
Post subject: | system.drawing.graphics shared code |
Here is a line from the PdfSharp feature list. Quote: One source code for drawing on a PDF page as well as in a window or on the printer Is there any sample of code shared between system.drawing.graphics and Xgraphics? For example a hello world where the same code could write to either a system.drawing.graphics or Xgraphics? Did I misunderstand the feature? Please explain how to draw the same thing to system.drawing.graphics and also to a PDF without duplicating code. |
Author: | sqlpaul [ Tue Dec 18, 2012 10:09 pm ] |
Post subject: | Re: system.drawing.graphics shared code |
Ah, I found the answer here. http://www.pdfsharp.net/wiki/Graphics.ashx Code: XGraphics gfx = XGraphics.FromGraphics(graphics, size); So you can't use system.drawing.graphics to draw on a PDF, but you can use XGraphics to draw on system.drawing.graphics. My document will need to be re-written with XGraphics and transformed from 1/72 inch to 1/96 inch so it will fit on standard LETTER size. But then I could conceivably use a single function to draw a PDF, or alternatively draw the same document to a graphics context from a print event handler. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |