Convert XAML to PDF on WinRT

241 views
Skip to first unread message

Ryan

unread,
Jan 14, 2015, 8:54:38 PM1/14/15
to pdfne...@googlegroups.com
Q: We are trying to create pdf pages of nicely laid out images and text programmatically. We would prefer to use XAML to layout the page, and a utility to convert them into PDF pages.

I see you have the Xaml2PdfTestCS sample on your site, but it is not complete, and I don't see it in the WinRT samples either.

I can’t see a way to do this using your WinRT API, but perhaps I missed it…

Using your PDF SDK for WinRT, is there a way to convert XAML to PDF?

A:

The way PDFTron converts XAML to PDF in Xaml2PDF sample is by serializing FlowDocuments to XPS, then using pdftron.PDF.Convert.FromXps()

Unfortunately it seems that WinRT is still missing support for FlowDocument API. This also applies to universal apps.

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/99fdca8b-ab23-415d-89da-3003b2078faf/flowdocument-for-winrt

That being said, it really depends on how complicated is the layout you need to produce. If you are dealing with basic text and images in a simple layout is should be quite straightforward. To help you get started please see: http://www.pdftron.com/pdfnet/samplecode/data/Text2PDF.zip  

Finally, while the PDFNet SDK on WinRT cannot itself convert from XAML or HTML to PDF, the PDFNet SDK on Windows desktop can do so.  You can find sample code for XAML to PDF conversion at http://www.pdftron.com/pdfnet/samplecode.html#XAML2PDF, and sample code for HTML to PDF conversion at http://www.pdftron.com/pdfnet/samplecode.html#HTML2PDF.

Some of our clients send XAML (or HTML) to a server of theirs, where PDFNet can convert the XAML (or HTML) to PDF.  Note that on Windows desktop there are many conversion options, including converting Office to PDF and converting any printable document format to PDF.


Reply all
Reply to author
Forward
0 new messages