Command line "soffice --convert-to pdf" doesn't comply with PDF/A3b when used with "-env:UserInstallation=..."

For this below soffice.exe pdf conversion command, why does specifying a user installation result in a PDF that is not PDF/A-3b?

I cannot find a rhyme or reason that including “-env:UserInstallation=…” in my pdf conversion command makes the coversion not respect the “SelectPdfVersion” PDF/A-3b arg. The convert command still provides a legible pdf, but the file has no PDF/A3b marker and isn’t compliant with that standard according to this PDF format verification site. Then, as soon as I omit the -“env:UserInstallation=…” from the command it spits out a nice PDF/A-3b compliant doc as expected.

soffice "-env:UserInstallation=file:///xxxx..somepath...xxx" --convert-to pdf:draw_pdf_Export:{\"SelectPdfVersion\":{\"type\":\"long\",\"value\":\"3\"}} report.pdf

I noticed in the temp UserInstallation path there’s no ‘sdraw’ folder like there is in the normal user installation path. This isn’t related, is it? (see below screenshot)

Thanks,
Michael

… and your question is … ?

Hello Mike, I’ve updated the post with the explicit question: “For this below soffice.exe pdf conversion command, why does specifying a user installation result in a PDF that is not PDF/A-3b?”

Which shell do you use? Is it cmd.exe? Or PowerShell? Or maybe something else? Which version? And please provide the exact output from the command that you see in the console.

I’m executing this command from C# code on Windows with Process.Start() which is close to the same thing as cmd.exe I’d think.

C:\Program Files\LibreOffice\program\soffice.exe "-env:UserInstallation=file:///C:/Users/michael.socha/AppData/Local/Temp/255f08c2ee6547afb338081367ed69d1" --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --writer --convert-to pdf:draw_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"3"}} --outdir C:\Users\michael.socha\AppData\Local\Temp C:\Users\michael.socha\AppData\Local\Temp\b405228100eb403b848a174396e647c0.docx

Unlikely. The quoting may be completely different.

But to be sure:

  1. Use soffice.com, not soffice.exe - to be able to get back cout.
  2. Check what was output to cout.

I very much expect, that the JSON that you pass there is not passed in a correct form to soffice, and in the end, it works as if you didn’t pass the filter arguments at all; and then, your last settings used in the profile are used. Thus, if you have manually chosen the wanted settings in the UI, such a command would produce the wanted result using that (default) profile, but different result when using a different profile.

Wow, you’re so quick. I should’ve waited until I got the console out and error before posting, but here’s the console out/err stream. This is using soffice.exe. When I remove "-env:UserInstallation=..." from the command I get a PDF/A3-b!
STD OUT:
convert C:\Users\michael.socha\AppData\Local\Temp\164333328ad343f197fc069b8cfc073f.docx as a Writer document -> C:\Users\michael.socha\AppData\Local\Temp\164333328ad343f197fc069b8cfc073f.pdf using filter : draw_pdf_Export:{SelectPdfVersion:{type:long,value:3}}
STD ERR:
Entity: line 1: parser error : Document is empty

Aha - indeed. No quotes around elements in the JSON → invalid JSON → not used.

The expected would be:

using filter : draw_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"3"}}

Awesome thank you. My coworker/boss is trying this now with the JSON idea. Will report back with results soon.

So the solution just worked passing an extra escape char.

Here’s the C# string passed to System.Diagnostics.Process.Start().

It is odd though, that I’m pretty sure I tried this before and it just kept locking until I killed the process manually.I hope I really did do something else differently and that it won’t randomly lock up again.

soffice "-env:UserInstallation=file:///xxxx..somepath...xxx" --convert-to pdf:draw_pdf_Export:{\"SelectPdfVersion\":{\\"type\":\\"long\",\\"value\":\\"3\\"}} report.pdf