Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a PDF/A from command line with Libre Office Draw in headless mode?

LibreOffice Draw allows you to open a non PDF/A file and export this a PDF/A-1b or PDF/A-2b file.

export as PDF

The same is possible from the command line by calling on macOS

/Applications/LibreOffice.app/Contents/MacOS/soffice --headless \
        --convert-to pdf:draw_pdf_Export \
        --outdir ./pdfout \
        ./input-non-pdfa.pdf

or an a Linux simply

libreoffice --headless \
        --convert-to pdf:draw_pdf_Export \
        --outdir ./pdfout \
        ./input-non-pdfa.pdf

On the command line it is possible to tell the convert-to to create a pdf and use LibreOffice Draw to do this by telling --convert-to pdf:draw_pdf_Export.

Is there also a way to tell LibreOffice to produce a PDF/A document in headless mode?

like image 630
saw303 Avatar asked Aug 15 '19 17:08

saw303


People also ask

What is LibreOffice headless?

The solution is the --headless option, which executes LibreOffice processes without launching the graphical user interface. For example, converting a document to EPUB is a pretty simple task in LibreOffice—but it's even easier with the libreoffice command: $ libreoffice --headless --convert-to epub example.odt.

Can LibreOffice Convert PDF?

No, LibreOffice will not convert a PDF to a DOC (or ODT) or so.


1 Answers

For PDF/A-1(means PDF/A-1b?):

soffice --headless --convert-to pdf:"writer_pdf_Export:SelectPdfVersion=1" --outdir outdir input.pdf

Change the value from 1 to 2 for PDF/A-2, here is the Libreoffice source code Common.xcs, pdfexport.cxx and pdffilter.cxx.

  • (Maybe outdated) API/Tutorials/PDF export - Apache OpenOffice Wiki
  • Python Guide - PDF export filter data - The Document Foundation Wiki
  • excel->pdf変換 command のdpi設定 - Ask LibreOffice
  • Change default resolution in batch PNG conversion [closed] - Ask LibreOffice
like image 92
schemacs Avatar answered Sep 24 '22 11:09

schemacs