使用--headless --convert-to flags将libdoffice转换为.doc(x)为PDF / A-1a格式

I am currently developing a PHP web application that can convert Microsoft doc(x) files to a PDF format automatically.

For that we use the libreoffice headless converter on our webserver (CentOS 6.5 x64).

The following command I use to convert the file;

libreoffice --headless --convert-to pdf /path/to/sourceFile.doc -outdir /path/to/dest

Everything works perfectly, but there is one problem.

The PDF output should be in PDF/A-1a format, currently it is in a default format.

I searched the web for hours, but I can't find the solution for this.

How can I change the output format?

My advise would be to use "Cloudooo" to convert media or office files on linux, the advantage is cloudooo support ooffice as well as libreoffice and restart the needed programs in case of crash.

The official repo on github is : https://github.com/nexedi/cloudooo

My forked version to export pdf/a instead of pdf : https://github.com/florianajir/cloudooo

You will need some afterwork with ghostscript.

ghostscript -dPDFA -dNOOUTERSAVE -dBATCH -dNOPAUSE -dQUIET -sProcessColorModel=DeviceRGB -dUseCIEColor -sDEVICE=pdfwrite -o "out.pdf" -dPDFACompatibilityPolicy=1 PDFA_def.ps "in.pdf"