How to call doc2any from PHP?

Q:Hello,
We are currently evaluating doc2any.exe for our website in order to convert documents on the fly. So far the results of our tests are quite good but we have noticed that:

1. PPT (not PPTX) conversion fails with a message:
Loading "upload/test5.ppt" file...[20%]
Shutdown PowerPoint Application...[60%]
Prepare to convert "upload/test5.ppt" file...[10%]
Loading "upload/test5.ppt" file...[20%]
Shutdown PowerPoint Application...[60%]
[FAILED] Can't locate EMF files.
Conversion time = 4930ms
upload/test5.ppt ==> C:\wamp\www\flexpaper\php\pdf\test5.pdf, result=ERROR TickCount = 4930ms(4.93s), Result = 0

I have seen that this issue may have been already reported to you. Is there a fix available?
Please note that this issue only arises when calling doc2any.exe from PHP (which is mandatory for us). Weirdly the same manual conversion via the MS DOS command prompt works!

2.
Visio document conversion: Doc2any does not seem to convert .vsd (MS VISIO) docs. Do you have any plan to make this available? In the meantime would you have an alternate solution that could be called from a PHP script?

3.
the < -pagerange > feature does not work. We have tried to convert doc to pdf (41 pages) and limit it to 3 pages but with no avail. Can you please let us know when this will be fixed?

In addition to the points above we have the following questions:

- Do you have an executable of your programs that can run on a linux platform?

- Does your program support multi-threading? What we mean is that if two users want to convert simultaneously two files will it work in parallel or is it based on an i/o basis?

- Can you confirm if you have other customers who have used your tool in a production server environment with a large number of files to be processed 24 x 24/7x7? Would you be able to provide customer references?

- We've had a close look at your knowledge section on your website but do you provide more detailed/ technical documentation so that we can use your product to its full potential?

- We also be very interested in a solution to convert Microsoft Projects file (.mpp) to PDF. Do you have a solution that would fit our need?

**************************************************************************

A:
1.
As there is no administrator privilege in web application,when you call it in web, please refer to the following ways.

http://www.verypdf.com/htmltools/callfromcsharp.html

All the exeshell are free.
https://www.verydoc.com/exeshell.html
https://www.verydoc.com/download/exeshell.zip

2.
We have tested the parameter -pagerange, it is OK on our website.

for example:"C:\doc2any.exe" -pagerange 2-4 "C:\example.doc" "C:\example_doc.pdf"

3.
Now we do not have such app that can run in Linux.

4.
This parameter supports multi-threading.

test-concurrent-conversion.bat

start "" "%CD%\doc2any.exe" -killoffice 0 -useprinter "%CD%\example.docx" "%CD%\example.docx.pdf"
start "" "%CD%\doc2any.exe" -killoffice 0 -useprinter "%CD%\example.doc" "%CD%\example.doc.pdf"
start "" "%CD%\doc2any.exe" -multipagetif -bitcount 1 -xres 300 -yres 300 -killoffice 0 -useprinter "%CD%\example.docx" "%CD%\example.docx.tif"
start "" "%CD%\doc2any.exe" -multipagetif -bitcount 1 -xres 300 -yres 300 -killoffice 0 -useprinter "%CD%\example.doc" "%CD%\example.doc.tif

**************************************************************************

Q:Thank you for your quick reply. Here's my feedback:

1.As there is no administrator privilege in web application,when you call it in web, please refer to the following ways.

http://www.verypdf.com/htmltools/callfromcsharp.html

All the exeshell are free.
https://www.verydoc.com/exeshell.html
https://www.verydoc.com/download/exeshell.zip

2.The same with the first question.

>> I have installed the exeshell.zip and tested with the php example you provided. At this stage I have no success - it seems to do nothing. It does not throw any error. I just get a blank page and no conversion occurs.

Here is the code I run:

$exeshell =new COM("exeshell.shell") or die("Can't start exeshell");
$exeshell->RunCommandLine("fred-PC\\fred", "*******", '"C:\wamp\www\flexpaper\doc2any_cmd\doc2any.exe" "C:\testverydoc\test1.doc" "D:\testsheell.pdf" ');
$exeshell = null;

***************************************************************************

A:Your code is right,

$exeshell =new COM("exeshell.shell") or die("Can't start exeshell");
$exeshell->RunCommandLine("fred-PC\\fred", "*******", '"C:\wamp\www\flexpaper\doc2any_cmd\doc2any.exe" "C:\testverydoc\test1.doc" "D:\testsheell.pdf" ');
$exeshell = null;

if you can't get it work, please by following steps to solve Error 1314 and try again,

https://www.verydoc.com/exeshell.html

Remark:

You may encounter Error 1314 in some Windows systems, please by following steps to solve this 1314 Error,

ERROR 1314:
~~~~~~~~~~~~~
1314 A required privilege is not held by the client. ERROR_PRIVILEGE_NOT_HELD
~~~~~~~~~~~~~
To resolve this issue:
1. Click Start, click Run, type "secpol.msc", and then press ENTER.
2. Double-click "Local Policies".
3. Double-click "User Rights Assignment".
4. Double-click "Replace a process level token".
5. Click "Add", and then double-click the "Everyone" group
6. Click "OK".
7. You may have to logout or even reboot to have this change take effect.

Please look at following web page for more information,

https://www.verydoc.com/blog/how-to-call-doc2any-exe-from-asp-code.html

You can also arrange MS Word run inside an interactive user account, please look at following web page for more information,

https://www.verydoc.com/doc-to-any-faq.html

>>3. We have tested the parameter -pagerange, it is OK on our website.
>>for example:"C:\doc2any.exe" -pagerange 2-4 "C:\example.doc" >>"C:\example_doc.pdf"
>> I can confirm that it does not work. Neither through the MS DOS command line >>(even executed with administrator privilege) or via PHP.
>>Here again I run it through windows 64 bits.

This problem is caused by permission issues, you may give enough permission to Word DCOM to try again, please look at following web page for more information,

http://verydoc.com/doc-to-any-faq.html

also, in “Console Root / Component Services / Computers / My computer / DCOM Config” option, “Your COM Name” should equal to “Microsoft Office Word 97 – 2003 Document” in your system, please give enough permission to “Microsoft Office Word 97 – 2003 Document” DCOM in your system to try again, you can also run “Microsoft Office Word 97 – 2003 Document” DCOM from an interactive user account to solve the permission restrictions in default system account.

>>4. Incidentally I have tested the -pagecount parameter. It does not work with >>PPT or PPTX documents at all. Is this a known error?

We will double check -pagecount parameter for PPT or PPTX documents shortly, if it is not support PPT and PPTX documents, we will solve this problem in the next version of DOC to Any Converter product, and we will send the new version to you asap.

***************************************************************************

As a reminder. The tests were conducted with a Windows 7 64 Ultimate Edition, Microsoft office 2010, Microsoft Visio 2007, OpenOffice 3.3,

1. -pagerange: This parameter works erratically.

When run from the Command Line and coupled with the -useprinter parameter it works for .doc and.docx documents but not for .ppt and .pptx documents.

It never works when used without the -useprinter parameter (even when cmd is executed as an administrator)

2 - Pagecount:

Works for .doc and doc.x document. Does not work for .ppt and .pptx. Returns wrong values when run against .pdf documents.

3 - MS Visio: Never managed to run a conversion. It always return an error.
These 3 issues are showstoppers for us. How can you help me resolve them because I cannot trigger the purchasing process of your solution if I cannot make them work in our dev environement. Is there a debug mode or a verbose log that can be created?

*******************************************************************************

>>1. -pagerange: This parameter works erratically. When run from the Command Line and coupled with the -useprinter parameter it works for .doc and.docx documents but not for .ppt and .pptx documents.It never works when used without the -useprinter parameter (even when cmd is executed as an administrator)

This is a minor problem, after you purchased the product, please send to us your Order ID, we will provide a new version to you asap, we will solve "-pagerange" problem in the new version to you asap.

>>2 - Pagecount:Works for .doc and doc.x document. Does not work for .ppt and .pptx. Returns wrong values when run against .pdf documents.We will fix the problem for PPT and PPTX documents in the new version too.DOC to Any Converter is not able to retrieve page count from .pdf, because it is not support PDF as input format. However, we can add this function to you at additional cost, if you are interest in this function, please feel free to let us know, we will provide a quotation for this function to you shortly.

>>3 - MS Visio: Never managed to run a conversion. It always return an error.
These 3 issues are showstoppers for us. How can you help me resolve them because I cannot trigger the purchasing process of your solution if I cannot make them work in our dev environment. Is there a debug mode or a verbose log that can be created?

If you have any further question about calling doc2any from PHP, please contact us by the ways supported on this website.

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

Random Posts

One Reply to “How to call doc2any from PHP?”

  1. Have you installed MS Word application? if not, you may install MS Word application first, and then run doc2any to try again, doc2any.exe will not work if your system hasn’t MS Word installed.

    VeryDOC
    —————————————
    The ms word is installed. When I execute the doc2any.exe in the CMD it works. But if I invoke a php with a web browser it does not

    Customer
    —————————————
    This problem is caused by permission of MS Word DCOM, please arrange MS Word run from an interactive user account instead of SYSTEM user account to try again, please refer to following web pages for more information,

    http://www.verydoc.com/doc-to-any-faq.html
    http://www.verydoc.com/blog/convert-word-doc-file-to-pdf-file-with-openoffice.html
    http://www.verydoc.com/others/configure-word-and-excel.htm
    http://www.verypdf.com/wordpress/201201/how-to-call-doc2any-exe-or-htmltools-exe-from-a-service-20896.html
    http://www.verydoc.com/blog/how-to-call-doc2any-exe-from-asp-code.html

    once you set MS Word DCOM run inside Administrator user account and allow Everyont user account to access to it, you will able to call doc2any.exe from PHP code properly.

    VeryDOC

    [Reply]

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

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!