LibreOffice PDF Export Results in Large File Size After Version Upgrade

I’m using LibreOffice on my server to convert Excel files to PDFs via the command line. After upgrading from LibreOffice version 7.4 to version 24.8, I noticed that the generated PDFs have significantly increased in size (from 152 KB to 3541 KB), despite the content and layout of the PDF being identical before and after the upgrade.

Command I’m using:

/libreoffice24.8/program/soffice --headless --nologo --nofirststartwizard --convert-to pdf --outdir /tmp /tmp/inputFile.xlsx

What I’ve observed: Before the upgrade: The generated PDF size was 152 KB, and the “Tagged PDF” property was set to No. After the upgrade: The generated PDF size is 3541 KB, and the “Tagged PDF” property is set to Yes. The content, orientation, and overall look of the PDFs are exactly the same.

What I’ve tried: Attempted to disable tagged PDFs using the following command, but got an error:

/libreoffice24.8/program/soffice --headless --nologo --nofirststartwizard --convert-to pdf --export-tagged-pdf=off --outdir /tmp /tmp/inputFile.xlsx

This resulted in the error: Error in option: --export-tagged-pdf=off

Used the writer_pdf_Export filter:

/libreoffice24.8/program/soffice --headless --nologo --nofirststartwizard --convert-to pdf:writer_pdf_Export --outdir /tmp /tmp/inputFile.xlsx

This did not reduce the file size.

Tried specifying the PDF version with this command:

libreoffice24.8/program/soffice --headless --nologo --nofirststartwizard --convert-to pdf:writer_pdf_Export:selectPdfVersion=1 --outdir /tmp /tmp/inputFile.xlsx

But the file size remained the same.

My requirements: I need to reduce the PDF file size to a level similar to what it was before the upgrade (around 152 KB). Disabling tagged PDFs is likely part of the solution, as tagging seems to be increasing the file size. I’d like to know if there’s a way to disable tagging or reduce the PDF size using LibreOffice’s command-line options in version 24.8.

Any guidance on how to resolve this issue would be greatly appreciated!

May be a reduction of images resolution can help you.
The pdf export filter has the options Reduce image resolution and JPEG compresion quality

Text unselecting ‘Archival PDF/A’ option.

The same problem for me, I tried plenty of possible commands none of which seemed to work
Any suggestions?

@sandeep1 Did you have any luck with it?

Where did you find this ?

Have you tried UseTaggedPDF as found in help? (Note also syntax with curly braces {} for parameters.)
https://help.libreoffice.org/latest/en-GB/text/shared/guide/pdf_params.html

All of these have been tried, as well as many more. Are you suggesting that it works for you?

--headless {csvFilter} --convert-to pdf:calc_pdf_Export:{"UseTaggedPDF":{"type":"boolean","value":false}}
--headless {csvFilter} --convert-to 'pdf:calc_pdf_Export:{"UseTaggedPDF":{"type":"boolean","value":false}}'
--headless {csvFilter} --convert-to pdf:draw_pdf_Export:{"UseTaggedPDF":{"type":"boolean","value":false}}
--headless {csvFilter} --convert-to 'pdf:draw_pdf_Export:{"UseTaggedPDF":{"type":"boolean","value":false}}'
--headless {csvFilter} --convert-to pdf:writer_pdf_Export:{"UseTaggedPDF":{"type":"boolean","value":false}}
--headless {csvFilter} --convert-to 'pdf:writer_pdf_Export:{"UseTaggedPDF":{"type":"boolean","value":false}}'
--headless {csvFilter} --convert-to pdf:writer_pdf_Export:{"TaggedPDF":false}
--headless {csvFilter} --convert-to pdf:"writer_pdf_Export:TaggedPDF=false"
--headless {csvFilter} --convert-to pdf:"writer_pdf_Export:UseTaggedPDF=false"
--headless {csvFilter} --convert-to pdf:"draw_pdf_Export:UseTaggedPDF=false"
--headless {csvFilter} --convert-to "pdf:UseTaggedPDF:false"
--headless {csvFilter} --convert-to pdf:UseTaggedPDF:false
--headless {csvFilter} --convert-to pdf:calc_pdf_Export:{"TaggedPDF":false}

Am I missing something?

[erAck: edited to format code as code, see This is the guide - How to use the Ask site? - #6 by erAck]

No, it is only habit to check, if your command should work “according to documentation”, because we see some invented ChatGPT-stuff now as well as the usual typos… As as I don’t know you, I was not silently assuming you tried valid syntax and posted something else here.

Most possibly you miss mentioning the full command line you tried, verbatim, using the “code” feature of this site (that allows to not change some characters into formatted things); and to mention your operating system and shell (and its version) where you use that commend. Because the command line syntax differs from shell to shell, and from version to version; and you likely need to escape the JSON when passing there.

See:

Hey @mikekaganski, surprisingly your passive-aggressive comments did work for me. I guess it might be useful for other folks:

I had to simply add another level of escaping so my final command-line looks like the following:

.\soffice.com --convert-to 'pdf:draw_pdf_Export:{\"UseTaggedPDF\":{\"type\":\"boolean\",\"value\":\"false"}}' 'C:\temp\test.csv' --outdir 'C:\temp\pwsh'

It would be amazing if it was mentioned on the official website, or come up with the descriptive error/warning in the command-line, but feel free to “wowing” on every person that keep on asking the question on forums and trying all possible solutions to make it work after the breaking changes.

[erAck: edited to format code as code, see This is the guide - How to use the Ask site? - #6 by erAck]

It would be amazing, if persons would tell wich OS they use (and wich shell), if they expect a qualifield answer.
.

Where have you found a breaking change?? (I think I know who added the possibility to change parameters via cli quite recently…) Or do you mean the size? Not what I call a breaking change. But ok, I would never tried your funny variants of parameters.

True, I could have been more descriptive with the details. Also, I usually just ask for more information without “most possibly you forgot”. But that is your choice and I won’t judge.

Answering the breaking change question, I believe that changing the default behavior that causes the files to contain additional data and have a size up to 7 times bigger than the previous default behavior seems to be the classic breaking change. But, again, you are free to introduce any changes, just try to understand that not everyone works with your codebase every day and have the knowledge of what exactly is needed for you to easily debug the issue or give a recommendation.

Hi @sashunchiq

This is the solution that worked for me.

TaggedPdf setting is found in the global configuration file at the following directory:
Path: /opt/libreoffice24.8/share/registry/main.xcd

Modify the Tagged PDF setting to false.
Solution.xlsx (53.6 KB)

Wow, modifying the program files instead of using the command line or user profile’s registrymodifications.xcu.