LibreOffice does not do a correct PDF conversion with PHP

asked 2020-07-29 15:40:29 +0200

gnosser gravatar image

Hello. I am trying to create a PDF from a Word file on the remote server with the exec command from PHP, everything looks something like this:

<? php
exec ('soffice --convert-to pdf --outdir C:\Sample_dir C:\Sample_dir\sample_file.docx')

Unfortunately, this works only partially - although the PDF file is created, any other font is used instead of the Univers LT Std 45 Light font, all tables are moved and blank pages are created. Oddly enough, with the Arial font, the new document looks a little better, but also not perfect. When I start the command on server from cmd

soffice --convert-to pdf --outdir C:\Sample_dir C:\Sample_dir\sample_file.docx

then the created file meets all expectations - fonts and tables are absolutely fine. I'm not sure if LibreOffice actually has anything to do with it, as a user I have the status nt-autority\system on this server, maybe the problem is there. Can anyone help me with this? Thanks.

edit retag flag offensive close merge delete


Make sure the user that execute PHP, have the same permissions

mauricio gravatar imagemauricio ( 2020-07-29 18:45:43 +0200 )edit

I am this user and i see this status in PHP when i test whoami.

gnosser gravatar imagegnosser ( 2020-07-30 09:19:45 +0200 )edit