How to I export a PDF page to WPF FixedPage?

91 views
Skip to first unread message

Support

unread,
Jan 10, 2013, 6:16:35 PM1/10/13
to pdfne...@googlegroups.com
Q:
 
I need to export a PDF page to WPF FixedPage (http://msdn.microsoft.com/en-us/library/system.windows.documents.fixedpage.aspx) for further manipulation and printing.
 
How do I do this with PDFTron PDFNet?
 
----------
A:
 

If you want to print a PDF via Windows XPS Print Path  (which is used under the hood in WPF / .NET), you can convert PDF to XPS using pdftron.PDF.Convert.ToPdf()  and print the XPS via Microsoft XPS Print API (see option #4 in https://groups.google.com/d/msg/pdfnet-sdk/fOuGOvx06Tk/EckAX-ga2i8J). Also see http://msdn.microsoft.com/en-us/library/windows/desktop/ff686814(v=vs.85).aspx

 

Alternatively if you just need to convert PDF page to WPF FixedPage export to XPS then use the following snippet to load FixedPage:

 

XpsDocument xps = new XpsDocument(FileName, FileAccess.Read);

FixedDocumentSequence seq = xps.GetFixedDocumentSequence();

foreach (DocumentReference r in seq.References) {

   FixedDocument d = r.GetDocument(false);

   foreach (PageContent pc in d.Pages) {

        FixedPage fixedPage = pc.GetPageRoot(false);  ...

    }

}

Reply all
Reply to author
Forward
0 new messages