PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Apr 18, 2024 8:30 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Nov 19, 2012 11:09 pm 
Offline

Joined: Mon Nov 19, 2012 10:42 pm
Posts: 1
Hi,

I'm quite exited about stumbeling over PDFsharp! However I'm having difficulty understanding the concepts.
In the examples there is always an XGraphics class used for drawing stuff. Why is there a difference between GDI and WPF versions if you have your own XGraphics class that does all the drawing? Somehow I think I'm missing a point?

What is the way to convert WPF pages to Pdf ones? Since there is a special WPF version it seems illogical that I would need to iterate through all visuals and convert each type one by one to an XGraphics equivilent?

For example, if I used a flowdocument and generated pages using the paginator, I'd like to call a function like this:
Code:
public static PdfSharp.Pdf.PdfDocument CreatePdf(System.Windows.Documents.DocumentPaginator paginator) {
  if(!paginator.IsPageCountValid) paginator.ComputePageCount();
  PdfSharp.Pdf.PdfDocument doc = new PdfSharp.Pdf.PdfDocument();

  for(int t = 0; t < paginator.PageCount; t++) {
    PdfSharp.Pdf.PdfPage pdfPage = doc.AddPage();
    System.Windows.Documents.DocumentPage page = paginator.GetPage(t);

    PdfSharp.Drawing.XGraphics gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(pdfPage); // <-- do I really need that?
    // will I have to recursively convert all "page" contents to "XGraphics" equivelents here?
    // Is there WPF specific stuff that will do all that for me?
  }
  return doc;
}

I took a peek into the XPS converter code, but there it looks like it is also iterating through each visual element.

Keep up the good work!
Cheers,
Louis


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 134 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