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?

Hi,

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;
try
{
//Converting Input file format to .pdf
proc.Start();
proc.WaitForExit();
}
catch (Exception ex)
{
_log.Error(ex);
Console.WriteLine(ex.Message);

if (!string.IsNullOrEmpty(AttachmentPath))
{
System.IO.File.Delete(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.
Customer
----------------------------------------

image
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,

https://www.verydoc.com/exeshell.html#VeryPDFComRunCmd_COM_Component
http://www.verypdf.com/dl2.php/VeryPDFComRunCmd.zip

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.

https://www.verydoc.com/blog/verydoc-release-notes-verydoc-releases-an-exe-com-of-verypdfcomruncmd-exe-today-verypdf-exe-com-does-allow-you-to-call-ms-office-and-any-exe-application-from-asp-php-c-net-etc-program-languag.html
 
http://www.verypdf.com/dl2.php/VeryPDFComRunCmd.zip
 
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,
<?php

$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,

https://www.verydoc.com/blog/verydoc-release-notes-verydoc-releases-an-exe-com-of-verypdfcomruncmd-exe-today-verypdf-exe-com-does-allow-you-to-call-ms-office-and-any-exe-application-from-asp-php-c-net-etc-program-languag.html

VeryDOC

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

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!