PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 9:47 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Feb 18, 2015 10:32 am 
Offline

Joined: Wed Feb 18, 2015 10:18 am
Posts: 2
Hi,

I have some existing code that I use to create printed documents in a winforms application.

When the document is sent to the printer, each page raises an event and passes it a Graphics object and using this I create the text/layout etc.

Is it possible leverage all my existing code, but just print to a PDF instead using PDFSharp, or do I have to recreate everything using the XGraphics object?

I have seen the method XGraphics.FromGraphics - which looked very promising but it's very unclear how, if at all, I can then use this to create a PDF document. Can't find any clear code examples.

Help much appreciated.
James


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 18, 2015 11:02 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi, James,

AFAIK you have to use the XGraphics object to do all the drawing.

By means of XGraphics.FromGraphics you can use XGraphics also to draw on the printer and on the screen.

So IIRC you have to touch your code, but a single code base will then serve printer and PDF.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 18, 2015 11:33 am 
Offline

Joined: Wed Feb 18, 2015 10:18 am
Posts: 2
Thanks Thomas.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 139 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group