transformDocument
- addBackgroundImage
- addFooter
- addHeader
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createDocx
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importHeadersAndFooters
- importStyles
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addTable
- addTableContents
- addText
- addTextBox
- addWordML
- embedHTML
- clearBlocks
- deleteTemplateBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- tickCheckbox
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