Date: prev next · Thread: first prev next last
2022 Archives by date, by thread · List index

Hi Mike,

I'm using LO on UbuntuStudio 20.04 LTS and your --headless command line instruction works 
and produces a pdf file which passed the pdfinfo check with flying colours. I just rechecked to 
make sure.   So maybe your problem is distro related?

But I don't use the --headless command very often because it breaks the links in my pdf output. So, I 
make use of the LO Writer gui to do   file> export as>export as pdf  which gets me a workable pdf 
with working links (clickable table of contents etc). If I need to reassemble some pdf docs, I use pdftk 
utility because so many of the others break those links.


On 11/04/2022 10:51, Mike Scott wrote:
I'm having a spot of bother trying to get a .ps or .pdf produced from a .odt using the command line.

I've revisited some code last used a few years ago, whose last step is just to use LO to do this 
conversion. It used to make a .ps file, but that now seems to have changed, and I get a .pdf 
instead - which is corrupt.

So I get for example

libreoffice --headless --print-to-file --outdir "./"  "./y.odt"
print /dhome/mike/homebrew software/service sheet production/web generator/y.odt -> /dhome/mike/homebrew 
software/service sheet production/web generator//y.pdf using <default_printer>

pdfinfo y.pdf
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error (2432): Illegal character '{'
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table

The resulting pdf won't load into a browser and upsets several of the pdf tools, although gimp or 
xreader can read it. Fortunately, pdf2ps accepts the file, so as a workaround, I do the LO 
--print-to-file and then run the result through pdf2ps and then back through ps2pdf; the result of 
that contortion seems OK.

Looking at the GUI instead, under the tools|options|print page, if I try to set options for print 
to file, the tick box for pdf is set and disabled. Yet if I select print to file in the normal 
print dialogue, I get a valid .ps file not a pdf.

I need to run this as a print job, since '--convert-to pdf' doesn't honour the brochure setting in 
place in the document. Using the GUI and printing works fine, but isn't useful for automated 

If anyone has a way better of doing a command line conversion to a pdf while honouring in 
particular the 'brochure' setting, I'd be grateful.

(This is with LO under mint 20)

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
Privacy Policy:


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.