How to convert Office file to PDF from web service applications?

In this article, I will show you how to convert Office file to PDF from web service applications. The software I use is named as VeryDOC Doc Converter COM, by this COM software, we can convert .doc, .xls, .html, .txt, .rtf etc files and any other printable files to PDF files. During the conversion, you can set page height, page width and other limitations to output PDF file. Please check more information of this software on homepage, in the following part, let us check how to use this software call DocConverter COM from PHP, ASP, C#, VB.NET, ASP.NET applications.

Step 1. Free download Doc Converter COM

  • When downloading finishes, there will be a zip file. Please extract it to some folder then you can check elements in it. There are some elements in the extracted folder: pdfout.dll, install_as_service.bat, install_as_exe.bat, uninstall.bat, and doc2pdf_service.exe.
  • doc2pdf_service.exe is an Windows Service Application,you can call this software from Web Service Applications easily, for example, once you call DocConverter COM from PHP, ASP, C#, VB.NET, ASP.NET applications, doc2pdf_service.exe will accept and execute all conversion tasks automatically. This application will be started by "install_as_exe.bat" and "install_as_service.bat" files.
    There is one example of calling doc2pdf_service.exe software:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    There are two methods to launch this software--"doc2pdf_service.exe" : run as a Windows System Service and run as a Normal Windows Application,
    1. Run As a Normal Windows Application: C:\>doc2pdf_service.exe "-exe"
    This Command Line will run doc2pdf_service.exe as a normal windows application.
    2. Run As a Windows Service: C:\>doc2pdf_service.exe -i
    This Command Line will install the "VeryPDF DocConverter COM Service" into your system.
    C:\>doc2pdf_service.exe -u
    This Command Line will uninstall the "VeryPDF DocConverter COM Service" from your system.
    C:\>net start "VeryPDF DocConverter COM Service"
    C:\>net stop "VeryPDF DocConverter COM Service"
    Above Command Lines will start/stop "VeryPDF DocConverter COM Service" from your system.

Step 2. Converting Office to PDF from web service application.

    • When you need to convert Office to PDF from web service application, please pay more attention to the following things:
      For ASP example:
      1 You need run "install_as_exe.bat" file first, and make sure "doc2pdf_service.exe" application is running,
      2. Please make sure "html2pdf.exe", "doc2pdf_service.exe", "doc2pdf_config.ini" and "pdfout.dll" files have been installed into your system32 folder,
      3. Please make sure you have already installed "PDFcamp Printer" product.
      Here is some code examples for your reference:

~~~~~~~~~~~~~~~~~~~
Set PdfCreator = New PDFOUTLib.PdfCreator
PdfCreator.Word2PDF "C:\sample.doc", "C:\sample.doc.pdf"
PdfCreator.Word2PDF "C:\sample.xls",  "C:\sample.xls.pdf"
PdfCreator.Word2PDF "C:\sample.ppt", "C:\sample.ppt.pdf"
MsgBox "Word2PDF_ShellPrint finished"
Set PdfCreator = Nothing
~~~~~~~~~~~~~~~~~~~

During the using, if you have any question, please contact us as soon as possible.

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!