Some test text!

Search
Hamburger Icon

UWP / Guides / Open MS Office file

Open MS Office documents and convert to PDF in UWP

Saving annotations back to non-PDF formats is not supported. You can instead save the annotated PDFDoc to a PDF file.

PDFViewCtrl has a powerful and seamless conversion system which allows you to stream documents during conversion to PDF. It supports the following file types:

  • Office file conversion: .docx, .pptx, .xlsx, .doc. (with the office conversion Add-On module)
  • Image conversion: .bmp, .jpg, .tif, .png, .gif
  • Image collections (zip archives with any type of image listed above)
  • Markdown: .md (with the office conversion Add-On module)

In this tutorial you will be able to display a non-PDF file in PDFViewCtrl.

Before going forward, please make sure you have finished setting up PDFViewCtrl as described in Implement PDF Viewer Control in UWP app .

The easiest way to display a non-PDF file in PDFViewCtrl is through the pdftron.UWP API.

Directly from an IRandomAccessStream

You must first retrieve a file as a IRAndomAccessStream Interface:

Windows.Storage.Streams.IRandomAccessStream StreamForConversion;

Then load the IRandomAccessStream Interface into an IFilter Interface:

pdftron.Filters.IFilter filter = new pdftron.Filters.RandomAccessStreamFilter(StreamForConversion);

Then add the following when you would like to show the document in your PDFViewCtrl:

pdftron.PDF.DocumentConversion.conversion = pdftron.PDF.Convert.UniversalConversion(filter, null);
pdftron.PDF.PDFViewCtrl.PDFViewCtrl.OpenUniversalDocument(conversion);

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales