06
Feb
Written by: Jonathan Maron. Stored in: Samples.

Since the initial release of LiveDocx last week, one of the most common questions that I keep receiving via e-mail is:

How can I convert DOC to PDF in PHP?

Although it was not the original intention of LiveDocx to offer such file format conversion, it is very possible. In this post, I would like to present a little class, which does exactly that.

In a future version of LiveDocx, there will be an additional component called Zend_Service_LiveDocx_Convert, which will offer a more efficient method of document conversion. When this version is released, it will make redundant the code in this post, but until then, here is a really easy way to convert DOC to PDF in PHP.

Note: You can use this technique to convert between any supported template formats to any supported document formats, not just DOC to PDF.

Step 1: Download Zend Framework

Download Zend Framework 1.10 or newer. All source code mentioned in this post is in the directory /demos/Zend/Service/LiveDocx/MailMerge/convert/.

Step 2: Convert DOC to PDF

In this demo application, we use Zend_Service_LiveDocx_MailMerge to convert document.doc to document.pdf.

In a future version of the LiveDocx service, a converter component will be made available.

Consider the following PHP code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$mailMerge = new Zend_Service_LiveDocx_MailMerge();
 
$mailMerge->setUsername('myUsername')
          ->setPassword('myPassword');
 
$mailMerge->setLocalTemplate('document.doc');
 
// necessary as of LiveDocx 1.2
$mailMerge->assign('dummyFieldName', 'dummyFieldValue');
 
$mailMerge->createDocument();
 
$document = $mailMerge->retrieveDocument('pdf');
 
file_put_contents('document.pdf', $document);
 
unset($mailMerge);

The converted file has been saved at document.pdf.

90 Responses to “Convert DOC to PDF in PHP”

  1. Hidayat Says:

    hi.. this is awesome, I’m looking for this tools like this for convert my RTF file that was generated from my application. now my application is faster than ever.

    Thank U..

  2. Jonathan Maron Says:

    I am glad you like phpLiveDocx and are using it your application.

    May I ask: What does your application do? How does it use phpLiveDocx?

  3. Benito Estrada Says:

    Hi,

    Thanks a lot for your work!

    This stuff is real useful!

  4. Goo Says:

    Can it conver excel. ppp to PDF?
    Away

  5. Jonathan Maron Says:

    phpLiveDocx converts and merges word processing file formats only. It does not support PowerPoint, nor Excel.

  6. Ivan Says:

    Unfortunately, this doesn’t work for me. I have installed Zend framework but when i run test script it simply prints ERROR (Converting document.doc to document.pdf… ERROR).

    How can I go deeper into error to see what exactly went wrong?

  7. Jonathan Maron Says:

    I think your web server environment may be the problem. Can I please ask you to refer to this blog post, which describes the “check-environment.php” script:

    http://tinyurl.com/mmqdj7

    However, to answer your question. Just open up “Converter.php” and replace line 44:

    } catch (Tis_Service_LiveDocx_Exception $e) { }

    with

    } catch (Tis_Service_LiveDocx_Exception $e) {

    Zend_Debug::dump($e);

    }

    That will show you the exception that is being thrown.

  8. Rahul Says:

    I dont have Zend Framework installed. I simply wish to use the code above without Zend Framework. Is that possible??

  9. Jonathan Maron Says:

    Hello Rahul. Yes, it is! You can use LiveDocx without the Zend Framework. I will be publishing a brief tutorial showing how in the next few days. However, installing the ZF is no hassle. Regards, Jonathan Maron

  10. Jonathan Maron Says:

    Hello again

    Please take a look at this article, which shows how to use LiveDocx in PHP without the Zend Framework:

    Does this work for you?

    Jonathan Maron

  11. Convert DOCX, DOC & RTF to HTML in PHP Says:

    […] phpLiveDocx 1.2, it is possible to generate documents in XHTML 1.0 Transitional. Thus, you can now convert any supported template file format (DOCX, DOC and RTF) to […]

  12. Nandish Says:

    Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home/unosoft/public_html/silibi/phplivedocx/library/Tis/Service/LiveDocx/MailMerge.php on line 116

  13. Jonathan Maron Says:

    Hello Nadish

    Are you sure that your web server has the correct permission to access the file? Did you try ‘chmod 775’?

    Can you see the contents of the file?

    Did you set the include path as described at http://is.gd/2qff8 ?

    Have you run the check-environment.php script, as described at http://is.gd/2qfme ?

    Pls post the output into the support forum http://is.gd/2qfqS .

    Thank you :-)

    Jonathan

  14. prokvk Says:

    Hi Jonathan,

    I have a problem. I followed all instructions and by what i can tell i got it to work. When i run my script i get the message:

    Converting file.doc to file.pdf…

    but nothing else no DONE nor ERROR is printed.

    Also the pdf file is not created.

    I used just this code you published there.

    Thanky you for your answer

  15. prokvk Says:

    I noticed now that i have 2 fails in the check-enviroment script.

    2: Checking SAPI (apache2handler)……………………………………FAIL
    3: Checking PHP version (5.2.2)……………………………………..FAIL

    But for the start …. how does my php 5.2.2 fail ??

  16. Jonathan Maron Says:

    Hello Prokvk

    Can you please open up “Converter.php” in a text editor and replace:

    } catch (Tis_Service_LiveDocx_Exception $e) { }

    with

    } catch (Tis_Service_LiveDocx_Exception $e) {

    Zend_Debug::dump($e);

    }

    That will show you the exception that is being thrown.

    Please post this error here.

  17. Jonathan Maron Says:

    Hello Prokvk

    Zend recommends the most current release of PHP for critical security and performance enhancements. Zend Framework currently supports PHP 5.2.4 or later. Hence, your version of PHP is too old.

    More info here: http://is.gd/2rqCs

  18. prokvk Says:

    Thank you for your response Jonathan .. I got it to work switching to newer version of PHP :)

  19. akhil kumar Says:

    is it necessary……………….to work on Zend framework to use “phplivedocx”.If not then tell me how can i use phplivedocx in WAMP.

  20. akhil kumar Says:

    I used this code and found this error ………

    #!/usr/bin/php Converting document.doc to document.pdf…
    Fatal error: Uncaught exception ‘Tis_Service_LiveDocx_Exception’ with message ‘Cannot connect to LiveDocx service at https://api.livedocx.com/1.2/mailmerge.asmx?WSDL // SOAP extension is not loaded.’ in C:\wamp\www\doc2pdf\phplivedocx\library\Tis\Service\LiveDocx.php:187 Stack trace: #0 C:\wamp\www\doc2pdf\phplivedocx\library\Tis\Service\LiveDocx.php(88): Tis_Service_LiveDocx::throwException(Object(Zend_Soap_Client_Exception), ‘Cannot connect …’) #1 C:\wamp\www\doc2pdf\phplivedocx\library\Tis\Service\LiveDocx\MailMerge.php(83): Tis_Service_LiveDocx->initSoapClient(‘https://api.liv…’) #2 C:\wamp\www\doc2pdf\phplivedocx\samples\Converter.php(38): Tis_Service_LiveDocx_MailMerge->__construct(”, ”) #3 C:\wamp\www\doc2pdf\phplivedocx\samples\mail-merge\convert\convert-document.php(20): Converter::convert(‘C:\wamp\www\doc…’, ‘pdf’) #4 C:\wamp\www\doc2pdf\doc2pdf.php(2): include_once(‘C:\wamp\www\doc…’) #5 {main} thrown in C:\wamp\www\doc2pdf\phplivedocx\library\Tis\Service\LiveDocx.php on line 187

    Can u short out the problem…..please.

  21. Jonathan Maron Says:

    Hello Akhil

    You do not have the SOAP extension in your PHP installation. Please consult the documentation of WAMP or ask your system administrator to find out how to install and activate SOAP in your PHP installation.

    Once you have done this, can I please ask you to follow the steps described at http://is.gd/3pJ77 and then post the output of check-environment.php here in the blog.

    Thanks

    Jonathan Maron

  22. Jonathan Maron Says:

    Hello Akhill

    You do not have to use the Zend framework to use phpLiveDocx. There are two other methods. Please refer to point 2 and 3 at http://is.gd/3pJm2 .

    Thanks

    Jonathan Maron

  23. akhil kumar Says:

    I am using third method, to convert doc to pdf i.e [SOAP connection via PHP 4 and PHP 5 NuSOAP.]

    When I run the script ,two PDF files get created and a display on screen is [Starting sample #1 (license-agreement)…DONE. Starting sample #2 (telephone-bill)…DONE.].

    But when I open the PDF file ,it shows ERROR MSG: [Format error-not a pdf file or corrupted].

    I have done all the setting like enabling SOAP, I have also downloaded the NuSOAP and kept in the same folder in which I have to run the script. PLEASE HELP ME TO SOLVE THE PROBLEM.

    My code is same as u have given on ur site, I have only changed the password and user name. U CAN SEE:

    […]

    Code taken from http://is.gd/3wK7G

  24. Jonathan Maron Says:

    Which PDF viewing problem are you using?

    How many bytes are the produced PDF files?

    Can you please send me the produced PDF files?

    E-Mail them to support @ textcontrol . com and write my name in the e-mail body.

    Thanks!

  25. akhil kumar Says:

    sorry…….i am not able to send the PDF file as it size is showing 0KB. now what i should do.

  26. Jonathan Maron Says:

    It seems that you are writing files to disk with no content. I think that the issues you are having are related to NuSOAP. I would suggest that you post a support case in the NuSOAP forum: http://is.gd/3wPKP

  27. akhil kumar Says:

    “writing files to disk with no content” Is this problem because i am running the code on localhost?

  28. Jonathan Maron Says:

    No. The problem is that NuSOAP is not getting any data (0 bytes). You are then writing this 0 bytes to the hard disk, hence the resulting PDF files are 0 bytes in size. What did the NuSOAP community say?

  29. akhil kumar Says:

    i am not able to find NuSOAP community. Your BLOG is too good , because i am getting the reply very soon.Thanks for this service.
    Please see the path setting of my NuSOAP in my php file:-
    /////////////////
    set_include_path (dirname(__FILE__) . ‘/nusoap-0.7.3/lib’);
    /////////////////

    my NuSOAP folder name is nusoap-0.7.3 and it is in the same folder from where i am running the script.IS it fine?and give me idea to handle this problem by my self.

  30. Jonathan Maron Says:

    Here is the NuSOAP community – http://is.gd/3wPKP – click on “Help” in the section “Project Forums”. Please post your issue in this forum. The NuSOAP community is specialized in NuSOAP. We are specialized in the Zend Framework component.

  31. Yung Says:

    This tool was very usefull in a project I´m working.
    Thank you!

  32. Ramakrishnan Says:

    Hi,
    i want to convert pdf/doc to html in a webpage.
    Then how to do this in php

    Thanks
    Ramakrishnant

  33. Vlad Says:

    Can I convert Doc – > PDF on your phpLiveDocx without the Internet?
    Thanks

  34. pdizz Says:

    Hey, I like the ability of this to work.. but I don’t wish to do this with actual files. I was wondering, is it possible to pipe data from a mysql BLOB (that I have files stored in…) and use the converter?

  35. สุขภาพ Says:

    Hello Sir,

    It’s very useful for me.

    But I have one problem before. I want to convert from html to pdf you have anyway because now I convert html to doc and I will convert doc to pdf.

    I weak in English.

    If you have way to solution my problem. Please send email to me.

    Thank.

  36. Jonathan Maron Says:

    @สุขภาพ: Try converting from HTML to internal TX Text Control format (tx) and then to DOC. I know that involves 2 conversions, but there is no other way to do this, using LiveDocx at the moment.

  37. Jai Says:

    Hi,

    I used above code, but i got SOAP-ERROR: Parsing WSDL from http://api.livedocx.com/1.2/mailmerge.asmx?WSDL.

    please give me solution.

    Thanks.

  38. Jonathan Maron Says:

    The WSDL is located at https://api.livedocx.com/1.2/mailmerge.asmx?wsdl

  39. Jai Says:

    When i executed ‘check-environment.php’ i got 2 fail msg

    phpLiveDocx Environment Checker
    1: Checking OS (WINNT)……………………………………………..PASS
    2: Checking SAPI apache2handler)……………………………………FAIL
    3: Checking PHP version (5.2.5)……………………………………..PASS 4: Checking memory limit (32M)………………………………………PASS 5: Checking HTTP stream rapper……………………………………..PASS
    6: Checking HTTPS stream rapper…………………………………….FAIL 7: Checking Zend Framework path……………………………………..PASS
    8: Checking Zend Framework version (1.9.6)……………………………PASS
    9: Checking SOAP extension………………………………………….PASS 10: Checking DOM extension…………………………………………..PASS 11: Checking SimpleXML extension……………………………………..PASS 12: Checking libXML extension………………………………………..PASS 13: Checking your IP address (124.125.46.22)…………………………..PASS 14: Checking your city (Gulbarga)…………………………………….PASS 15: Checking your region (Karnataka)………………………………….PASS 16: Checking your country (India)…………………………………….PASS

  40. Jai Says:

    Can u give me solution for those above 2 fail msg.

    Thanks

  41. Nisarg Says:

    thanks. i am ver thank ful. pleas, also keep the .ppxt to .ppt convertor

  42. Jonathan Maron Says:

    LiveDocx is all about word processing and word processing formats. Therefore, we currently do not support these file formats.

  43. Solow Says:

    I’m having some trouble getting started… I can’t find the files. I downloaded Zend framework, but I can’t find them anywhere. Help would be well appreciated.

    solow

  44. jeanson Says:

    Hello everybody,

    I’m trying to use the example code of converting doc to pdf but I always get :”Fatal error: Class ‘Converter’ not found “. I’ve downloaded the Zend framework and i run successfully the check-environment.php.
    It looks like I can’t find the Converter class. Where is it located ?
    Could someone help me, please ?

  45. Jonathan Maron Says:

    @Solow Go to http://www.zendframework.com/download/latest and download “1.10.0 Full”. Zend_Service_LiveDocx is contained within!

  46. Jonathan Maron Says:

    @jeanson You can download Converter.php here: http://pastebin.com/f43bf23ed. However, I have simplified the above post so that it no longer requires the said file :-)

  47. Solow Says:

    So, Zend 1.9.7 full doesn’t have phpLiveDocx?

  48. Jonathan Maron Says:

    Correct! It is only available as of ZF 1.10. You can read the documentation here: http://framework.zend.com/manual/1.10/en/zend.service.livedocx.html

  49. Solow Says:

    ZendFramework-1.10.0rc1

    I downloaded it. I hope I’m not to annoying but, How do I use this? I NEVER used zend before. so I have absolutely no idea what to do. everybody keeps giving me url’s, which don’t make any sence. I just need someone explaining to me what it does exactly, and how to use it. Do I upload ALL files? or just some I use? or… whatever :P

    I hope u can do this for me :)

  50. Solow Says:

    Ah never mind. I installed zend, now I want to use this, to convert my doc to pdf.

    couple of questions: What if the file is docx?
    How do I convert *now I finally installed zend.*
    $phpLiveDocx->setUsername(‘username’)
    ->setPassword(‘password’);
    what is this?

  51. dexta Says:

    dear Jonathan,

    Though I got to like the application, is there a way to have the zend engine stripped off the un-necessary parts [eg currency converter, json etc] just to have base components and the converter, well of course keeping the ease of use as is currently.

  52. Vinay Says:

    hi Jonathan

    i am able to use this code on localhost but when i use it on server it says Fatal error: Class ‘Zend_Service_LiveDocx_MailMerge’ not found in..
    Plz Help

  53. Jonathan Maron Says:

    @Vinay: This is probably because your include path on the server is different from that on your localhost. Update the include path to fix the problem.

  54. uks Says:

    Hello,

    In my application , I have a form in which user enter values and at the end of the process we have to generate a pdf so that user can take print out. I am using dompdf html to pdf converter in php. Since the form is rich in images and lots of nested tables it is not working properly. The form html is generated from a ms word file, which is the paper form. Will LiveDocx will help me ? or any other suggestions ?

    Thanks
    uks

  55. Jonathan Maron Says:

    @uks This is exactly a use-case for LiveDocx. To get started, please take a look at the documentation. It contains many sample applications:

    http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/
    http://www.phplivedocx.org/articles/pdf-generation-with-zend-framework/
    http://www.zendframework.com/manual/en/zend.service.livedocx.html

  56. Raza Says:

    Hello plz tell me what is the problem i got this error

    Fatal error: Call to undefined method Zend_Locale::setdefault() in C:\xampp\htdocs\Converter\common.php on line 17

    Its urgent

  57. Asep Khoirudin Says:

    can i get script converter php to pdf

  58. subh Says:

    I have a little complicated word files with the nested tables inside. The placement of words is messed up in pdf files. I am using free version. Could be better if i use premium package?.

    Please

  59. rahul Says:

    Hi Jonathan,
    i’m using zend framework 1.7 and i want to convert doc file to pdf by using livedox. And i’ve downloaded the needed livedox lib files. But i’m getting error like

    Call to a member function SetLocalTemplate() on a non-object in C:\xampp\htdocs\opsystem\library\Zend\Service\LiveDocx\MailMerge.php on line 91

    Can you tell me how to resolve this issue. If you can tell me bit faster it can be very useful to me.

    Thank you.

  60. conversion scripts - Hot Scripts Forums Says:

    […] so I'd start there, and work your way back. For example, this link… uses LiveDocx 1.2 Convert DOC to PDF in PHP You should find more info if you google LiveDocx. Same with converting images from 2d to 3d. […]

  61. yt Says:

    I am trying to use LiveDocx to convert all the files in a directory from Word to HTML- but the whole server seems to crash after the 6th or 7th file. Any ideas?

  62. Jonathan Maron Says:

    @yt It seem that you are using LiveDocx in a batch operation. I sincerely recommend you create a queue, iterate through the queue, catch any exceptions and then replace the active iteration into the queue. After each exception, wait a few seconds. Take a look at this PHP 5.3 code: http://pastebin.com/DrhG82LK

  63. Faom Says:

    Hi, I’m just trying to get a pdf in the browser but I’m getting a blank response.

    I’m calling a zend controller via ajax which have the following code

    public function exportpdfAction()
    {

    $mailMerge = new Zend_Service_LiveDocx_MailMerge();

    $mailMerge->setUsername(‘myuser’)
    ->setPassword(‘mypasswd’);

    $mailMerge->SetRemoteTemplate(‘valorar.doc’);
    $mailMerge->createDocument();
    $document = $mailMerge->retrieveDocument(‘pdf’);
    file_put_contents(‘valorar.pdf’, $document);
    }

    Anybody can tell me what is wrong, why I’m getting a blank response without any warnings or errors.

    Thanks so much for the support you can provide me.

    Regards

  64. Faom Says:

    Should the document be stored, or it’s transfered from livedocx to my app ready to be rendered or downloaded?

  65. Jonathan Maron Says:

    @Faom

    The code that you have posted will correctly generate the document “valorar.pdf”. However, you say you are calling the controller, using AJAX, but yet you write “valorar.pdf” to disk and do not return it to the browser. I believe this is the issue that causes the blank page. Instead, send the binary data returned from retrieveDocument() to the browser, encoded as a JavaScript object.

    If, however, you expect the “download file” dialog in the browser to appear, then you want to send the binary data directly to the browser, setting the correct header for a PDF file. Consider the following code:

    $this->_helper->viewRenderer->setNoRender();

    foreach ($this->getFrontController()->getPlugins() as $plugin) {
    $this->getFrontController()->unregisterPlugin($plugin);
    }

    $this->_response->setHeader(‘Content-Type’, ‘application/pdf’)
    ->setHeader(‘Content-Length’, strlen($document))
    ->setHeader(‘Content-Disposition’, ‘attachment;filename=”valorar.pdf”‘);

    $this->_response->setBody($document);

    Does this solve the issue?

  66. rahul Says:

    hi,

    can you help me with a code in php that can convert TIF Frechscript Images to ms word doc format?

    regards

  67. Jonathan Maron Says:

    @rahul I am sorry, but I am not familiar with “TIF Frechscript images”. Images in TIFF (tagged image file format) can be inserted into templates or via the API. Can you please clarify, what you mean by “TIF Frechscript images”.

  68. sonic Says:

    Hi,

    I use script at this page: http://www.phplivedocx.org/articles/…end-framework/

    my server responded : Starting sample #1 (license-agreement)…DONE.
    but, I can’t get document as PDF, where is it ?

  69. FAOM Says:

    Hi I don’t know why, but the first time I can get well the pdf, but after the first time, I can’t get it again, and I’m getting an error> Cannot login into LiveDocx service – username and/or password are invalid. In order to get well again the document I should refresh the whole page. Why this is happening? any comments? The following is the ZF code I’m using>

    public function exportpdfAction()
    {
    $mailMerge = new Zend_Service_LiveDocx_MailMerge();
    $mailMerge->setUsername(‘XXX’);
    $mailMerge->setPassword(‘XXX’);
    $mailMerge->SetLocalTemplate(‘valorar.docx’);
    $mailMerge->assign…. /// assign method here
    $mailMerge->createDocument();
    $document = $mailMerge->retrieveDocument(‘pdf’);
    $file=time().’valorar.pdf';
    $this->view->file = $file;
    file_put_contents(“cache/”.$file, $document);
    }

  70. Jonathan Maron Says:

    @FAOM: You may have been suffering some networking issues at your end. Can you please try again? Are you able to reproduce the issue today? The code looks fine to me.

  71. Richard Says:

    I get Fatal error: Class ‘Zend_Service_LiveDocx_MailMerge’ not found

    You say to update the include path. I tried this using set_include_path but it didn’t work. What exactly should be appended to the incluse path please? The zend library is in
    /home/xxxx/public_html/zend/library

    I appended that, but no joy.

  72. Jonathan Maron Says:

    @Richard This is certainly a problem with your include_path and/or autoloader. PHP is unable to find the class. Can you please post all your code?

  73. vishal Says:

    hey iam new in zend framework and also in web development…….will you please tell me the procedure to use this “doc to pdf” conversions, where me should put my document.doc files in project……because it comes an error on line :$mailMerge->setLocalTemplate(‘document.doc’); for me……..
    please tell me asap

    many thanx

  74. Prabhjot Says:

    We used the Zend phplivedox code and when we check environment we are getting following problem:
    2: Checking SAPI apache2handler)……………………………………FAIL

    Could you tell me how can we resolve this problem?

  75. shi Says:

    Can someone please help me how to resolve this problem. I’m getting the following error:

    Fatal error: Class ‘Zend_Service_LiveDocx_Exception’ not found in C:\wamp\library\zendframework\ZendFramework-1.11.7\library\Zend\Service\LiveDocx.php on line 265

    Thanks!

  76. Jonathan Maron Says:

    @shi Have you set your include_path?

  77. shi Says:

    Yes I have set my include_path:

    include_path = “.;c:\php\includes;C:\wamp\library\zendframework\ZendFramework-1.11.7\library”

  78. Richard Says:

    Sometimes the service works, but we often get:

    PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/xxxx/public_html/zend/library/Zend/Soap/Client.php:995

  79. shashi Says:

    Hi, i would like to use phplivedocx to embed the word documents in my drupal site. So i wish i can use phplivedocx to convert a word document into pdf on the fly and display it in an iframe.

    But what about the zend framework part? Do i need to host the Zend framework as part of the drupal files?

  80. Ankur Says:

    That is really helpful.
    Thanks :)

  81. abdelNarj Says:

    In the two following lines of the above PHP code , wich login and password you are talking about:
    $mailMerge->setUsername(‘myUsername’)
    ->setPassword(‘myPassword’);

    We tried the login and password of our local windows session and we had the error:
    *****
    Fatal error: Uncaught exception ‘SoapFault’ with message ‘Server was unable to process request. —> The user name/password combination is not valid.’ in C:\Zend\library\Zend\Soap\Client.php:1121 Stack trace: #0 C:\Zend\library\Zend\Soap\Client.php(1121): SoapClient->__soapCall(‘LogIn’, Array, NULL, NULL, Array) #1 [internal function]: Zend_Soap_Client->__call(‘LogIn’, Array) #2 C:\Zend\library\Zend\Service\LiveDocx.php(256): Zend_Soap_Client->LogIn(Array) #3 C:\Zend\library\Zend\Service\LiveDocx\MailMerge.php(95): Zend_Service_LiveDocx->logIn() #4 C:\wamp\www\testdoc\docWord.php(30): Zend_Service_LiveDocx_MailMerge->setLocalTemplate(‘Word.doc’) #5 {main} Next exception ‘Zend_Service_LiveDocx_Exception’ with message ‘Cannot login into LiveDocx service – username and/or password are invalid’ in C:\Zend\library\Zend\Service\LiveDocx.php:260 Stack trace: #0 C:\Zend\library\Zend\Service\LiveDocx\MailMerge.php(95): Zend_Service_LiveDocx->logIn() #1 C:\wamp\www\testdoc\docWord.php(30): Zend_Service_LiveDocx_MailMerge->setLocal in C:\Zend\library\Zend\Service\LiveDocx.php on line 260
    ***
    Thanks for your help.

  82. Jonathan Maron Says:

    First of all, you need to register an account to use LiveDocx. Do this at:
    https://www.livedocx.com/user/account_registration.aspx
    Once you have your username and password, pass these values to the methods setUsername() and setPassword().Only then will you be able to access LiveDocx.

    The error you are getting means that your username and password are not correct.

  83. abdelNarj Says:

    Thank you very much Jonathan, you’re really helpful, but unfortunately we can ‘t integrate Livedox in our solution (we need to do this operation without to need to connect to internet (locally)), because it requires a rederiction to your website to do the conversion, this requires internet,good luck :)

  84. Carolan Batchelder Says:

    On my computer, Windows updated itself to Windows 7. How do I change my Word documents from .doc to .docx ?

  85. Carolan Batchelder Says:

    I currently cannot open my .doc files – any of them.

  86. Converting .doc, .docx, .xls, .xlsx to pdf Says:

    […] In regards to codeplex, check out the following. Does it have Microsoft endorsement? PHPExcel – Stable PHPWord -Beta PHPPowerPoint – Alpha In regards to livedocx, I probably meant phplivedocx Convert DOC to PDF in PHP […]

  87. Nick Says:

    Hi I seem to be getting a blank document when the file is coming back from being converted and was wondering if you would be able to point me in the right direction. The blank output occurs when trying to convert a file upon upload setting the

    $tempFile = $_FILES[‘file’][‘tmp_name’];
    $docx->setLocalTemplate($tempFile);

    Works ok if i manually specify a file location but doesn’t seem to work as above.

    Cheers
    Nick

  88. ani Says:

    I downloaded zend 1.10 then extract it in my local www folder (Wamp) the modify the code as you told

    $phpLiveDocx->setUsername(‘XXXXX’)
    ->setPassword(‘XXXXXXX’);

    then run this convert-document.php page I am getting this error -“ERROR: LIVEDOCX USERNAME AND PASSWORD HAVE NOT BEEN SET. 1. Using a web browser, register to use the LiveDocx service at: https://www.livedocx.com/user/account_registration.aspx (takes less than 1 minute). 2. Change directory into: C:\wamp\www\ZendFramework-1.10.0\demos\Zend\Service\LiveDocx 3. Copy configuration.php.dist to configuration.php. 4. Open configuration.php in a text editor and enter the username and password you obtained in step 1 (lines 43 and 44). 5. Save and close configuration.php. Congratulations! You have now set up the Zend_Service_LiveDocx demo applications.”

    But my user name and password is working perfectly (I checked it in http://www.livedocx.com)Can u tell me step by step what I have to do..

  89. cr7cr7 Says:

    je cherche une soulution pour mon erreur
    je suis entrain d’utiliser le zend framwork pour convertire une fichier .doc en document.pdf
    mais toujours il m’affiche cette erreur

    Warning: SoapClient::SoapClient(https://api.livedocx.com/1.2/mailmerge.asmx?WSDL) [soapclient.soapclient]: failed to open stream: Permission denied in /home/www/ZendPrivate/library/Zend/Soap/Client/Common.php on line 51

    Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity “https://api.livedocx.com/1.2/mailmerge.asmx?WSDL” in /home/www/ZendPrivate/library/Zend/Soap/Client/Common.php on line 51

    Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘https://api.livedocx.com/1.2/mailmerge.asmx?WSDL’ : failed to load external entity “https://api.livedocx.com/1.2/mailmerge.asmx?WSDL” in /home/www/ZendPrivate/library/Zend/Soap/Client/Common.php:51 Stack trace: #0 /home/www/ZendPrivate/library/Zend/Soap/Client/Common.php(51): SoapClient->SoapClient(‘https://api.liv…’, Array) #1 /home/www/ZendPrivate/library/Zend/Soap/Client.php(1032): Zend_Soap_Client_Common->__construct(Array, ‘https://api.liv…’, Array) #2 /home/www/ZendPrivate/library/Zend/Soap/Client.php(1188): Zend_Soap_Client->_initSoapClientObject() #3 /home/www/ZendPrivate/library/Zend/Soap/Client.php(1112): Zend_Soap_Client->getSoapClient() #4 /home/www/ZendPrivate/library/Zend/Service/LiveDocx.php(256): Zend_Soap_Client->__call(‘LogIn’, Array) #5 /home/www/ZendPrivate/library/Zend/Service/LiveDocx.php(256): Zend_Soap_Client->LogIn(Array) #6 /home/www/ZendPrivate/library/Zend/Service/LiveDocx/MailMerge.php(96): Zen in /home/www/ZendPrivate/library/Zend/Service/LiveDocx.php on line 260

    je suis nouveau dans le zend framwork et je ne comprend pas comment corriger cette erreur.

  90. Lin Rongxiang Says:

    Just wondering whether there might be a tutorial that converts pdf from doc using from-scratch scripts.. zend is nice according to the site mentioned above.. thanks for the guide

Leave a Reply