Hello,
We have purchased yesterday the doc2any.exe product (DOC to Any Converter Command Line Server License), and are trying to use it in our test server (after previous successful tests in development environments).
VeryDOC DOC to Any Converter Command Line:
http://www.verydoc.com/doc-to-any.html
However, we are getting some issues which I would like to ask you to help us resolve.
Context:
- We are calling doc2any.exe from a Java / Grails web application
- We do have MS Office installed on the machine (Excel 2013 (15.0.4569.1504) 32 bits => Office (15.0.4569.1504) 32 bits)
- OS is Windows Server 2012 R2 Standard (64 bits)
- We do have Apache OpenOffice 4.1.2 installed on the machine as well
Questions:
- Can you please suggest what may be the reason for the failures (FAILED messages)?
- It seems doc2any.exe is unable to locate the MS Office libraries needed, are there any prerequisites such as environment variables, registry entries, etc.?
- We are getting a trace related to the license: is it possible the license has not been properly activated?
- Also, we are unable to execute doc2any.exe with "-runasuser" and "-runaspwd" parameters: could you please advise why this is happening?
Details:
1. Execution with MS Office => (ok in command line (cmd), KO from web application):
o Execution: doc2any.exe -log "" "" ""
o Output:
C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/contrato_160216-B000044.xlsx ==> C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000044.pdf
Convert Excel document by MS Office or OpenOffice application...
Convert Excel to other formats directly.
[FAILED] Failed by SaveAs function in MS Excel application...
[FAILED] Failed by Render Excel to Metafile function...
2. Execution with OpenOffice => (ok in command line (cmd), KO from web application):
o Execution: doc2any.exe -useopenoffice -log "" "" ""
o Output:
[Message] Check license information...
[Message] Check utility functions...
[Message] Start the conversion...
Convert OpenOffice Documents to other formats by OpenOffice: 'C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/contrato_160216-B000047.xlsx'=>'C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000047.pdf'
[Run] Run Conversion...
[Run] java -jar "C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\excel\doc2any_cmd\jodconverter-2.2.2\jodconverter-cli-2.2.2.jar" "C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/contrato_160216-B000047.xlsx" "C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000047.pdf"
[FAILED] Create 'C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000047.pdf' file failed by OpenOffice.
[Message] Enter ProcessPDFFile(): 'C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000047.pdf' => 'C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000047.pdf'
3. Additional server trace:
[Message] "C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/contrato_160216-B000047.xlsx" ==> "C:/Program Files/Apache Software Foundation/Tomcat 7.0/temp/excel_contract_160216-B000047.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.
TickCount = 0ms(0.00s), Result = 0
[Message] You have 295 time to evaluate 'VeryDOC DOC to Any Converter Command Line' product, you may purchase a full version from 'http://www.verydoc.com/doc-to-any.html' web page. ???
4. Failed execution with username / password => (KO both in command line (cmd) and from web application)
o Execution: doc2any.exe -runasuser "usuario" -runaspwd "passwd" -log "" "" ""
o Output: No error is returned, however the output file is not created, and return codes are one of the following:
. 1314
. 1326
Can you please explain what do we need to do differently?
Customer
----------------------------------------------------
This problem is caused by permission restrictions of Java running user account.
However, you can use "VeryPDFComRunCmd COM Component" to run doc2any.exe application from your Java code, you may download "VeryPDFComRunCmd COM Component" from following web page to try,
http://www.verydoc.com/exeshell.html#VeryPDFComRunCmd_COM_Component
https://www.verypdf.com/dl2.php/VeryPDFComRunCmd.zip
Please look more detailed usage from this web page,
You can run "install.vbs" to install "VeryPDFComRunCmd.exe" into your system first, "install.vbs" is contain following command line,
VeryPDFComRunCmd.exe /regserver
You can run this command line in CMD window by administrator privilege by manual too.
After you register VeryPDFComRunCmd.exe successful, you can run "DCOM-SetPerm.bat" to set permissions to "VeryPDFCom" COM Component. You can also use administrator privilege to run following command lines by manual to set enough permissions to "VeryPDFCom" COM Component,
dcomperm -aa {5E13F0FD-FD2D-4331-A27D-07ADA7766E66} set everyone permit
dcomperm -al {5E13F0FD-FD2D-4331-A27D-07ADA7766E66} set everyone permit
After you execute above steps successfully, you can call "VeryPDFCom" from your ASP code easily,
<%
set VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
dim nRetVal, bRet
strRet = VeryPDFCom.RunCmd2("D:\VeryPDF\doc2any.exe D:\test.doc D:\out.pdf", 5)
Response.Write strRet & vbCrlf
%>
If you wish call "VeryPDFCom" from Java code, you can use com4j or other methods, please look at following web pages for more information,
http://com4j.kohsuke.org/
http://stackoverflow.com/questions/138028/is-it-possible-to-call-a-com-api-from-java
If you wish avoid to use the "VeryPDFCom" COM method, please look at "Example #7" from following web page,
http://www.verydoc.com/doc-to-any-shell.html
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 docPrint_Service.zip 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";
Console.WriteLine(strArguments);
proc.StartInfo.Arguments = @strArguments;
proc.Start();
proc.WaitForExit();
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.
You can call doc2any.exe via docPrint_client.exe from you Java code, then you can overcome restrictions of Java user account easily.
If you encounter any problem with above solution, please feel free to let us know, we will assist you asap.