transformDocument
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- modifyPageLayout
- parseStyles
- 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
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
transformDocument


Transforms documents into other formats (DOCX, PDF, (X)HTML, DOC, RTF, PNG, TXT).
This method allows to transform a document, generated or not with phpdocx, into DOCX, PDF, HTML, DOC, ODT, RTF, PNG and TXT preserving, as much as possible, the original formatting options.
You may find more info regarding this method in the Conversion plugin section.
source
Path to the document that you want to convert to a different format.
target
Path to the resulting transformed document (PDF, HTML, XHTML, DOCX, DOC, ODT, RTF, PNG or TXT).
method
Method used to transform the document: 'native', 'libreoffice', 'msword', 'openoffice'
'native' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
dompdf | DOMPDF | dompdf instance. |
addHeadersAndFooters | bool | True as default. If true, add header/footer default type. |
stream | bool | False as default. If true, returns the document as stream. |
'libreoffice' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
comments | bool | False by default. Export comments |
debug | bool | False by default. Returns debug information about the conversion plugin. |
escapeshellarg | bool | False by default. Applies escapeshellarg to escape the source string. |
extraOptions | string | Extra parameters to be used when doing the conversion. |
formsfields | bool | False by default. Export form fields. |
homeFolder | string | Set a custom home folder to be used for the conversions. |
lossless | bool | False by default. Lossless compression. |
outdir | string | Set the outdir path. Useful when the PDF output path is not the same than the running script. |
pdfa1 | bool | False by default. Generate PDF/A-1 document. |
pdfa2 | bool | False by default. Generate PDF/A-2 document. |
pdfa3 | bool | False by default. Generate PDF/A-3 document. |
toc | bool | False by default. If true updates the TOC before transforming the document. |
'msword' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
selectedContent | string | Scope: 'active' (default) or 'documents'. |
toc | bool | False by default. If true updates the TOC before transforming the document. |
'openoffice' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
debug | bool | False by default. Returns debug information about the conversion plugin. |
homeFolder | string | Set a custom home folder to be used for the conversions. |
odfconverter | bool | True by default. If set to false the conversion plugin does not use ODFConverter package. This may give better results in some cases. |
tempDir | string | Set a custom temp folder to be used for the conversions. |
version | string | 32-bit or 64-bit architecture. 32, 64 or null (default). If null autodetect. |
Method not available.