How to call doc2any.exe from PHP source code to convert a xlsx file to pdf?

Hello, I'm trying doc2any.exe to convert a xlsx file to pdf, so far is working fine on command line but when I use shell_exec on php i get the following response:

[Message] You have 299 time to evaluate 'VeryDOC DOC to Any Converter Command Line' product, you may purchase a full version from '' web page.
[Message] Conversion time = 0ms [Message] "C:\inetpub\wwwroot\generados\SMR47001000000009794437.xlsx" ==> "C:\inetpub\wwwroot\out.pdf", result=ERROR
[Warning] If the conversion is fail, it may caused by permission problem, please run a CMD window by administrator privilege, and run same command line to try again. doc2any.exe is only require administrator privilege at first time when you run it.

Because MS Office can't be run from Local System user account directly, so you need arrange MS Office or doc2any.exe run inside an interactive user account, we have several solutions for you to solve this problem,

Solution 1: Use VeryPDFComRunCmd COM to call doc2any.exe from PHP code, please look at following web pages for more information,

Solution 2: Set MS Office DCOM run inside an interactive user account instead of default Local System user account,

Solution 3: Run conversion via "docPrint_Service.exe" application, please look at Example #7 from this web page,

Example #7 (Run conversion via "docPrint_Service.exe" application),

docPrint Service can be used to run a Command Line from current active user account or a special user account, this tool is useful to overcome permission restrictions in SYSTEM and Non-Interactive user accounts.

Please by following steps to use docPrint Service,

1. Download and unzip it to a folder,

2. Run docPrint_Service.exe application, you will see an icon appear in tray area,

3. You can run following command lines to test it first, "docPrint_client.exe" will deliver the Command Line to docPrint_Service.exe application, docPrint_Service.exe application will execute the Command Line from active user account automatically,

docPrint_client.exe nowait "C:\VeryDOC\doc2any.exe" C:\test.doc C:\out.pdf
docPrint_client.exe wait "C:\VeryDOC\doc2any.exe" C:\test.doc C:\out.pdf

4. You can call "docPrint_client.exe" from your code, please refer to a simple C# code at below,

public partial class rundoc2any: System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
Process proc = new Process();
proc.StartInfo.FileName = "C:\\VeryDOC\\docPrint_client.exe";
string strArguments = "wait C:\\VeryDOC\\doc2any.exe C:\\test.doc C:\\test.pdf";
proc.StartInfo.Arguments = @strArguments;
Response.Write("File has been successfully converted");

5. Close Remote Desktop and leave this user logged in.

*Please Notice: After you reboot the server, you need login your server via Remote Desktop with this user account ("doc2pdf_service.exe" was installed inside this user account), and close Remote Desktop, leave this user logged in, when you call docPrint_client.exe application, the conversion will be executed from this user account automatically.


VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: -1 (from 1 vote)
How to call doc2any.exe from PHP source code to convert a xlsx file to pdf?, 10.0 out of 10 based on 1 rating

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!