JSON API - transformDocument
- addBarcode
- addBookmark
- addBreak
- addCaption
- addChart
- addComment
- addCrossReference
- addDateAndHour
- addDropCap
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addPageNumber
- addRuby
- addSimpleField
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordML
- addWordFragment
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setCompatibilityMode
- setDefaultFont
- setDocumentDefaultStyles
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHTML
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
transformDocument
PREMIUM
TRIAL / ADVANCED
Transforms documents into other formats (PDF, DOCX, DOC, ODT, RTF, PNG, TXT).
Note
You are reading the JSON API documentation. For the PHP API method please go to transformDocument.
This method allows to transform a document, generated or not with phpdocx, into PDF, DOCX, DOC, ODT, RTF, PNG and TXT preserving, as much as possible, the original formatting options.
JSON data
| Key | Description |
|---|---|
| document | Document to transform. Path to the local document, Base64 string, or URL. |
| targetFormat | The target format for the transformation. Available formats: "doc", "docx", "html", "odt", "pdf", "png", "rtf", "txt". |
| method | Method used to transform the document: "libreoffice". |
"libreoffice" method options:
| Key | Description |
|---|---|
| comments | False by default. Export comments. Check the macros-libreoffice folder to use this option. |
| escapeshellarg | False by default. Applies escapeshellarg to escape source and LibreOffice path strings. |
| extraOptions | Extra parameters to be used when doing the conversion. |
| formsfields | False by default. Export form fields. Check the macros-libreoffice folder to use this option. |
| homeFolder | Set a custom home folder to be used for the conversions. |
| lossless | False by default. Lossless compression. Check the macros-libreoffice folder to use this option. |
| outdir | Set the outdir path. Useful when the output path is not the same than the source path. |
| path | Sets the LibreOffice path. This option can be used instead of the path option in config/phpdocxconfig.ini. |
| pdfa1 | False by default. Generate PDF/A-1 document. Check the macros-libreoffice folder to use this option. |
| pdfa2 | False by default. Generate PDF/A-2 document. Check the macros-libreoffice folder to use this option. |
| pdfa3 | False by default. Generate PDF/A-3 document. Check the macros-libreoffice folder to use this option. |
| toc | False by default. If true updates the TOC before transforming the document. Check the macros-libreoffice folder to use this option. |
Code samples
Example #1
A document can be a local file, a Base64 string, or a remote file.
Release notes
- phpdocx 18.0:
- new action.
