COMING SOON: Fall 2024 Release

Word to PDF Conversion Cross-Platform

By Aleksy Jones | 2015 Sep 08

Sanity Image
Read time

3 min

We’re pleased to launch the newest addition to Apryse Office SDK: built-in Word conversion. Now you can go straight from .docx to .pdf, free from the shackles of Microsoft Word or other 3rd party software. Conversions are accurate and fast, and they work on any platform supported by Apryse SDK (and there are a lot of them! Just choose your platform with your free trial).

.docx file format shown on Word page full of text using Office SDK

Dependency-free Word conversion enables some great use cases: you can perform reliable conversions in a server environment, or pair it with our PDF viewer for seamlessly viewing .docx files on Android, iOS, and Windows Phone/RT.

We offer support for a range of programming languages, including GoLang, that you can leverage to facilitate the conversion of your .docx documents into PDF files.

Easy to Use, But Flexible

Copied to clipboard

We’re striking a balance between power and simplicity in the API. To demonstrate that, check out this small snippet on converting a Word document to a PDF (in Java).

// Start with a PDFDoc (the conversion destination)
PDFDoc pdfdoc = new PDFDoc();
// perform the conversion with no optional parameters
Convert.wordToPdf(pdfdoc, "input_file.docx", null);
// save the result
pdfdoc.save("output_file.pdf", SDFDoc.e_remove_unused, null);

That’s it, just 2.5 lines of code. Maybe you'd rather have more control over the conversion process. That’s possible too: the interface allows for cancellation, progress reporting, page-by-page conversion, and diagnostic messages (for example, information on font substitutions). Here's the same conversion, performed page-by-page and with progress reporting.

// get a DocumentConversion object, which encapsulates and controls
// the conversion process
DocumentConversion conversion = Convert.wordToPdfConversion(
    pdfdoc, "input_file.docx", options);
// convert each page, one-by-one, with progress reporting
while(conversion.getConversionStatus() == DocumentConversion.e_incomplete)
{
    conversion.convertNextPage();
    System.out.println("Progress: " + (conversion.getProgress()*100.0) + "%");
}
// save the result
pdfdoc.save("output_file.pdf", SDFDoc.e_linearized, null);

To see these snippets as part of a fully working application, see the OfficeToPDF sample project in the Apryse SDK.

No Fonts? No Problem

Copied to clipboard

While you can embed fonts within .docx documents, typically you don't. On a typical Windows system this isn’t a problem: the most common fonts in Word documents (Calibri, Times New Roman, Arial, Cambria, etc. ) are installed by default on every Windows system, and are used while converting or viewing the document.

On other systems, like Linux servers or Android phones, these fonts are available only in special circumstances. Without them, you are limited to two options: 1) Distributing the original fonts alongside your app, or 2) Settling for poor conversion results.

With our Office SDK, this is no longer happens: we use numerous strategies so conversion remains faithful to the original — with content in the right place and on the right page — even when no external fonts are supplied. For a more practical and in-depth look at font-handling, see this knowledge base article.

It Keeps Getting Better

Copied to clipboard

We put lots of work into our .docx converter. We’re very proud of it, and committed to improving it.

For most documents created in Word (Word 2010 or Word 2013, for example), the converter yields excellent results, often indistinguishable from Word itself. Unfortunately, the .docx format is extensive and underspecified: the specification is more than 5000 pages, and riddled with omissions and exceptions. There may be features or behaviours we haven't quite nailed down. But that’s OK! We’re a small dev team and we move fast. If you’ve got a use case in mind, download our SDK and try it out. If something isn’t working for you, let us know through our free trial support form, and we’ll get it cleared up right away.

What About PowerPoint and Excel?

Copied to clipboard

PowerPoint and Excel to PDF conversions are included in our Office to PDF Conversion SDK. With our Office SDK, you can convert .docx, .doc, .xlsx and .pptx on any web, mobile, server or desktop software without users needing any Microsoft Office software, Microsoft Office licenses, or third-party open-source software. You can also convert Office files to other files types like PDF, PDF/A, or image file types.

Conclusion

Copied to clipboard

The built-in .docx conversion module is available as part of the Apryse SDK for Windows, Linux, Mac, Android, iOS, and UWP. To obtain a free trial, visit our downloads page.

The Office SDK download contains fully functional sample applications which demonstrate how to use the converter. Access our OfficeToPDF sample project and select your preferred language: C#, C# (.NET Core), C# (Xamarin), C++, Java, Java (Android), JavaScript, JS (Node.js), Kotlin, Obj-C, Swift or VB.

If you have technical questions, visit our free trial support form or for information about licensing, please contact us. We'll direct your inquiry to a developer or our sales team, as appropriate.

Sanity Image

Aleksy Jones

Share this post

email
linkedIn
twitter