Frameworks
React Native
Flutter
Package samples
Cookbook
Version 11
Version 10
Version 9
Version 8
Version 7
Version 6
Version 5
To convert an MS Office file to a PDF document without any external third party dependencies.
Convert MS Office files to PDF
Full sample code which illustrates how to convert MS Office files (Word, Excel, PowerPoint) to PDF.
The converter will attempt to make use of any fonts installed on the system. Fonts (or alternatives) can also be provided as described below.
Self serving substitute fonts faq
A more detailed faq guide about creating substitute web fonts set when a font is not embedded in the document or available on the system.
Self serve font package
A curated package of fonts with great coverage of widely used font files. Simply extract and pass the path to the API above.
The converter can produce good results with no user-supplied fonts at all, but for the highest conversion quality, fonts can be provided in a .docx resource document. This document must be named pdftron_convert_resources.docx
and can reside in either in the resource directory (use PDFNet.AddResourceSearchPath() to set this value), or at some arbitrary location, specified in the conversion options (set via OfficeToPDFOptions.SetResourceDocPath()). The file should have all the required fonts embedded within it (you can create a file like this by checking the "embed fonts in the file" option from the "Save" preferences within Word )
If no appropriate fonts are found on the system or in a resource .docx, then the converter will need to use it's own fallback font data. On desktop/server, this data is built into the library and will be automatically used. On mobile, the data is not part of the binary, but is included in the SDK package as a separate resource file: pdftron_layout_resources.plugin
. This file can either be placed in the resource directory (set via PDFNet.AddResourceSearchPath()), or in some arbitrary location, specified in the conversion options.
When the conversion routine is able to find a matching font, it will embed that font in the resulting PDF. Otherwise, the converter will attempt to embed one of the PDF base 14 fonts if there is a close enough match, and failing that, will not embed the font at all.
Using pdftron-supplied smart substitution data, the conversion routine can produce PDF documents with fully embedded fonts that are a close match to the originals. To enable this option, either place the file pdftron_smart_substitution.plugin
(included in the SDK download) in the resource directory (set via PDFNet.AddResourceSearchPath()), or specify it's path directly in the conversion options.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales