I'm attempting to convert .docx
files to .pdf
via soffice
, using the following command:
soffice --convert-to pdf input.docx --outdir <outdir>
The conversion succeeds without any error. However, the hyperlinks do not work. The hyperlinks in the file are relative links to other PDF files in the same directory.
The hyperlinks do not work - no matter what PDF reader I use, the hyperlinks aren't clickable.
I tried the following to narrow down my issue:
- Open the document in LibreOffice and “edit” the first hyperlink, open and close the dialog without doing anything.
- Save the .docx file in
LibreOffice
, and then run the headlesss conversion CLI viasoffice
. - Observe that only the first hyperlink works - the one we “edited” without changing anything.
I opened the actual .docx
internals, and found the _rels
files were exactly identical. The only difference was that the hyperlink I “edited” had this additional tag in the word/document.xml
:
<w:rStyle w:val="InternetLink" />
Some googling me found this unanswered issue. It appears that LibreOffice expects the InternetLink property to be present when converting hyperlinks to pdf.
My question is - how can I use soffice
to convert the .docx
to .pdf
while retaining hyperlinks? Is there a code change I can make to the LibreOffice source code?