How to call doc2any.exe from PHP source code?

Dear Sir

I am evaluating your product and I require some help.
Our proposed portal is being developed in Php running on Tomcat.

The requirement:

A user loads a word / excel / ppt document. Let us say the user loads test.doc. The document is renamed to user1011.doc based on a logic and is uploaded in a directory called upload.

The first page of test.doc needs to be converted to a gif file user1011.gif. This should be saved in the upload folder.

This is what I have done so far:

Moved the following three files to the root directory of localhost: cimage.dll, doc2any.exe and pdftoolsdk.dll.

In the php program I placed the following codes relevant to doc2any.

$infile=$directory . $filname;
$outfile= "uploads/" . $docname . ".gif";
echo $infile; returns uploads/v.doc
echo "";
echo $outfile; returns uploads/v.gif
$timage=$dir .'\doc2any.exe -nooffice -pagerange 1 ' .$infile . $outfile;
$result = exec($timage) ;
if(! $result )
{
    die('Problem with doc2any :: ' . mysql_error());
}

When executed I get an error message:

Problem with doc2any ::

Please let me know where I am going wrong.

Can I also convert the first page of a pdf upload?

What sort of licensing needs to be purchased? We plan to host this portal on Godaddy server sometime in July.

Appreciate your comeback.

Regards
Customer
----------------------------------------------------------
This problem is caused by permission restrictions in SYSTEM user account, you can use VeryPDFComRunCmd COM to call doc2any.exe from PHP code to try again.

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("D:\verydoc\doc2any.exe D:\test.doc D:\out.pdf", 5, 0)
strRet = VeryPDFCom.RunCmd2("D:\verydoc\doc2any.exe D:\test.doc D:\out.pdf", 5)
Response.Write strRet & vbCrlf

%>

This is a PHP source code example to call doc2any.exe by VeryPDFComRunCmd COM interface,

<?php

$VeryPDFCom = new COM("VeryPDFCom.RunCmd") or Die ("Did not connect");
$strRet = VeryPDFCom->RunCmd2("D:\verydoc\doc2any.exe D:\test.doc D:\out.pdf", 5);

?>

You can use VeryPDFComRunCmd COM to overcome limitations in SYSTEM user account easily, please give it a try.

You can also refer to more solutions to overcome limitations in SYSTEM user account from following web pages,

https://www.verydoc.com/blog/failed-to-call-doc2any-exe-from-c-or-vb-net-source-code.html
https://www.verydoc.com/doc-to-any-shell.html
https://www.verydoc.com/blog/running-doc2any-as-a-scheduled-task.html
https://www.verydoc.com/blog/failed-to-call-doc2any-exe-from-java-application-to-convert-pptx-and-docx-files-to-pdf-files.html
https://www.verydoc.com/blog/cannot-test-doc2any-on-net.html
https://www.verydoc.com/blog/running-doc2any-from-java-program-by-run-as-service-option.html
https://www.verydoc.com/blog/how-to-call-doc2any-exe-from-asp-code.html

>>Can I also convert the first page of a pdf upload?

If you wish convert first page of PDF file to image file, you can use VeryPDF PDF to Image Converter Command Line software,

http://www.verypdf.com/app/pdf-to-image-converter/try-and-buy.html

>>What sort of licensing needs to be purchased? We plan to host this portal on Godaddy server sometime in July.

You need to purchase DOC to Any Converter Command Line Server License,

https://www.verydoc.com/doc-to-any.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!