Replies: 5   Views: 199
How to add exportformfields whne converting to pdf using libreoffice

Posted by admin  · 07-02-2024 - 08:41


Thanks for sending more information about your question.

There's no option in phpdocx to set the internal ExportFormFields option available in LibreOffice as false. When the formsfields option in transformDocument is set as true, phpdocx uses the ExportFormFieldsToPdf macro to do the transformation, otherwise the default conversion is done.

We have moved this question to the dev team to consider adding a new option in phpdocx to set ExportFormFields as false in a future release of phpdocx.
To set ExportFormFields as false you could use one of the following approaches:

  • Use the ExportFormFieldsToPdf macro ((macros-libreoffice/macros/Export forms when transforming to PDF.txt) available in phpdocx but changing it to disable this option:
oPropertyDataValue.Name = "ExportFormFields"
oPropertyDataValue.Value =  0
soffice --headless --convert-to 'pdf:writer_pdf_Export:{"ExportFormFields":{"type":"boolean","value":"false"}}' --outdir /path/outputs/ /path/document.docx