Hi Mike,

I'm using LO 6.4.7.2 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.

Philip

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 processing.

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 6.4.7.2 under mint 20)

--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Reply via email to