PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Export to PDF by using LibreOffice's binary

Open Pierstoval opened this issue 10 months ago • 1 comments

So far, a few PDF exporters have a bridge in PHPWord, but the output depending on the library can be a bit inconsistent (latest example to date: #2534, apparently).

With LibreOffice, we can use a script like the ones suggested in the official docs: https://help.libreoffice.org/latest/en-US/text/shared/guide/pdf_params.html

The documentation must be taken in account because the soffice binary might have several different versions, leading to a possible maintenance burden on the parameters depending on the versions. (as example, on one of my project, I convert some OpenDocument files into PDF via this command: soffice --headless --convert-to pdf:writer_pdf_Export --outdir {{output}} {{input}} ).

Issue asked gently by @Progi1984 , so here it is 👍

Pierstoval avatar Feb 21 '25 20:02 Pierstoval

will the project access merge requests? if so I would like to step in.

As far as i can see we need to define, which writer we use as a base (WordXXXX oder ODT) and then pass the result along libreoffice to write the actual file.

We could also add a small wrapper to the docs, which encourages users to use the prefered writer and then have a standalone document converter class, which could possibly be a standalone project.

Which solution is prefered?

kaystrobach avatar Aug 28 '25 18:08 kaystrobach