transformDocument

transformDocument

ADVANCED / PREMIUM BASIC

Transforms DOCX documents into PDF.

Description
public void transformDocument(String source, String target)
public void transformDocument(String source, String target, HashMap<String, String> options)

This method allows to transform a DOCX document, generated or not with Javadocx, into PDF preserving, as much as possible, the original formatting options.

Installation

This method uses LibreOffice in headless mode to transform the documents and works on Windows, Linux and macOS. After installing LibreOffice in the server, import the following JARs from the program/classes folder of LibreOffice: juh.jar, jurt.jar, ridl.jar and unoil.jar.

Parameters

source

Path to the DOCX that you want to convert to a different format.

target

Path to the resulting transformed document.

options

The possible keys and values are:

Key Type Description
pdf/A-1 String If set, generate a PDF/A-1 document.
Code samples

Example #1