How to call doc2any.exe from web application to convert Office documents include DOC, DOCX, XLS, XLSX, PPT, PPTX, ODT etc. documents to PDF files?


We purchase a verydoc cmd line package for using on a Windows Server. Our license is: XXXXXXXXXXXXXXXXX.
We moved to another VM and now VeryDoc CmdLine is not working anymore. ExitCode = 4.

Pls help with this issue as our cistomers are awaiting for solution.

I attached the order.

Our code to convert a odt file (could also be an .xls, .xlsx, etc file):
string appPath = @"c:\VeryDoc\doc2any_cmd\doc2any.exe ";
string strCmd1 = @" -useopenoffice -$ XXXXXXXXXXXXXXXXX 'E:\sources\GMS\VMH2.WebApp\DownloadedFile\Email\example_01_30_2020_01_14_59.odt' 'E:\sources\GMS\VMH2.WebApp\UploadTempFile\TempPdf\EmailViewPDF_6f48c036-09f5-4968-bdb4-f6c8dc2ca46c.pdf' ";

Process proc = new Process();
proc.StartInfo.FileName = appPath;
proc.StartInfo.Arguments = strCmd;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
//Converting Input file format to .pdf
catch (Exception ex)

if (!string.IsNullOrEmpty(AttachmentPath))
message = "Error.Unable to Generate PDF";

In above case the input file is just the example.odt which is included in the zip package.

When I am on a command line windows and executed the command manually, it convert the .odt to .pdf. But when executed within our web application it does not convert.

Pls help asap.

Thanks for your message, we understand your meaning, this problem is caused by the restrictions in Local System user account, when you call doc2any.exe from a web application, you need run doc2any.exe inside an interactive user account instead of default Local System user account, because Local System account has lots of restrictions.

You can use VeryPDFComRunCmd COM Component to run doc2any.exe from interactive user account, VeryPDFComRunCmd COM Component can be downloaded from this web page,

VeryPDFComRunCmd is an EXE COM Component which can be used to launch any EXE or Office application from ASP, PHP, C#, .NET etc. program languages. VeryPDFComRunCmd COM is a freeware.
You can use following ASP code to call any EXE or MS Office without any permission problem,


set VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
dim nRetVal, bRet
bRet = VeryPDFCom.RunCmd("C:\windows\notepad.exe", 5, 0)
strRet = VeryPDFCom.RunCmd2("cmd /c dir C:\", 5)
Response.Write strRet & vbCrlf

Here is a PHP example to call an EXE application by VeryPDFComRunCmd COM,

$comobj = new COM("VeryPDFCom.RunCmd") or die("Couldn't create the COM Component");
$strCmd = $comobj->RunCmd2("cmd /c dir C:\", 5);
echo("Output is:\r\n" . $strCmd);

ASP.NET example to call an EXE application by VeryPDFComRunCmd COM,

dim VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
dim strCmd = """C:\VeryPDF\htmltopdf.exe"" C:\Test\in.html C:\Test\out.pdf"
Response.Write(strCmd & vbCrlf)
dim strRet = VeryPDFCom.RunCmd2(strCmd, 5)
Response.Write(strRet & vbCrlf)

For more information, please look at this web page,


VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in DOC to Any Converter and tagged , , , , , , , , , . Bookmark the permalink.

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!