A Doc Converter COM that convert HTML/Word to PDF file  Home  PDFcamp  Support  Screen Shot  Doc2PDF_COM  Articles  Products  Downloads

convert html to pdf

User manual for DocConverter COM product
1. Convert documents to PDF files from Command Line
2. Convert documents to PDF files from Windows Application Mode
3. Convert documents to PDF files from Windows Service Mode

4. Doc Converter COM Component user manual

1. How convert a HTML, DOC, DOCX, RTF, TXT, PPT, PPTX, XLS, XLSX, etc. file to PDF file from Command Line?
Step 1:
    Please download and install the PDFcamp Printer (PDF Writer) software,
    http://www.verypdf.com/pdfcamp/pdfcamp_setup.exe
Step 2:
    Please download the DocConverter COM software,
    http://www.toppdf.com/pdfcamp/doc2pdf_com_trial.zip
    Please run "install_as_exe.bat" to install DocConverter COM into your system or register pdfout.dll file by manual, for example,
    ~~~~~~~~~~~
    regsvr32 pdfout.dll
    ~~~~~~~~~~~
Step 3:
    Please run the html2pdf.exe software from the Command Line Window, the html2pdf.exe software is included in the DocConverter COM package,
    For example:
    html2pdf.exe "http://www.yahoo.com" "c:\yahoo.pdf"
    html2pdf.exe "http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=pdf" "c:\google.pdf"
    html2pdf.exe "C:\example.doc" "C:\example.pdf"
    html2pdf.exe "C:\example.xls" "C:\example.pdf"
Step 4:
    Congratulations! You have converted HTML, DOC, RTF, TXT, PPT, XLS files to PDF documents now.
Step 5:
    Now, you can call the html2pdf.exe software from your Delphi, C++, VB, BCB etc. applications.


2. How convert a HTML, DOC, DOCX, RTF, TXT, PPT, PPTX, XLS, XLSX, etc. file to PDF file from Windows Application Mode, via ASP, PHP, C#, etc. program languages?
Step 1:
    Please download and install the PDFcamp Printer (PDF Writer) software,
    http://www.verypdf.com/pdfcamp/pdfcamp_setup.exe
Step 2:
    Please download the DocConverter COM software,
    http://www.toppdf.com/pdfcamp/doc2pdf_com_trial.zip
    Please run "install_as_exe.bat" to install DocConverter COM into your system, "doc2pdf_service.exe" will be run as a normal windows application,
Step 3:
    Please use following example code to convert your documents to PDF files,
     ASP Example:

    <%
        set PdfCreator = Server.CreateObject("PdfOut.PdfCreator")
        ConvertHTMLToPDF1 PdfCreator,"http://www.google.com","google001.pdf"
        set PdfCreator = nothing

        function ConvertHTMLToPDF1(byval PdfCreator, strHTMLFile, strPDFFile)
            'The first method to create a PDF file from HTML file
            strPDFFile = server.mappath(".") & "\" & strPDFFile
            dim strCommandLine
            strCommandLine = """" + strHTMLFile + """"
            strCommandLine = strCommandLine + " "
            strCommandLine = strCommandLine + """" + strPDFFile + """"
            strCommandLine = strCommandLine + " "
            strCommandLine = strCommandLine + """" + "paperType=6" + """"
            Response.write "HTML To PDF Command Line1 is: " & strCommandLine & "<br>"
            PdfCreator.Doc2PDFCommandLine(strCommandLine)
        end function
    %>
     PHP Example:
    <?php
        $url = "http://www.verypdf.com";
        $outfile = "C:\\test.pdf";
        $com = new COM("PdfOut.PdfCreator");
        $com->Doc2PDFCommandLine("\"$url\" \"$outfile\" \"paperType=0,PrintHTMLBackground=yes,overwrite=yes\"");
    ?>
    C# Example:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using PDFOUTLib;

    namespace FunWithVeryPDF
    {
        class Program
        {
            static void Main(string[] args)
            {
                try
                {
                    PdfCreator wert = new PdfCreator();
                    wert.Doc2PDFCommandLine("""http://www.google.com"" ""C:\temp\out.pdf""")
                    wert = null;
                    Console.WriteLine("Done");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
    }
Step 4:
    You can convert .html, URL, .doc, .docx, .rtf, .ppt, .pptx, .xls, .xlsx, txt etc. files to PDF files from your ASP, PHP, C#, etc. program languages now.

*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 Doc2PDFCommandLine() function, the conversion will be executed from this user account automatically.


3. How convert a HTML, DOC, DOCX, RTF, TXT, PPT, PPTX, XLS, XLSX, etc. file to PDF file from Windows Service Mode, via ASP, PHP, C#, etc. program languages?
Step 1:
    Please download and install the PDFcamp Printer (PDF Writer) software,
    http://www.verypdf.com/pdfcamp/pdfcamp_setup.exe
Step 2:
    Please download the DocConverter COM software,
    http://www.toppdf.com/pdfcamp/doc2pdf_com_trial.zip
    Please run "install_as_service.bat" to install DocConverter COM into your system, "doc2pdf_service.exe" will be run as a windows service application,
Step 3: (Settings for MS Office documents)
     If you need convert MS Office documents to PDF files from Service Mode, please read this step carefully, if you need only convert HTML files to PDF files, please simple skip this step.
    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when run in this environment. So, we have to launch the conversion from an interactive user account, please by following steps to set an interactive user account for conversion,

    1. Open "C:\windows\system32\doc2pdf_config.ini" file, set "IsRunUnderUserAccount" to 1
, and set User Name and Password for an interactive user account, MS Office application will be run inside this interactive user account to instead of SYSTEM account,

    [doc2pdf_config]
    IsRunUnderUserAccount=1            //Set this value to 1
in order to run MS Office from an interactive account
    UserAccountName=Administrator    //
An interactive user account, e.g., "Administrator"
    UserAccountPass=123456             //Password for
this interactive user account, e.g., "123456"

    2. Please add "Everyone" user account to
"Replace a process level token" by following steps,
        2.
1. Click Start, click Run, type "secpol.msc", and then press ENTER.
        2.2. Double-click "Local Policies".
        2.3. Double-click "User Rights Assignment".
        2.4. Double-click "Replace a process level token".
        2.5. Click "Add", and then double-click the "Everyone" group
        2.6. Click "OK".
        2.7. You may have to logout or even reboot to have this change take effect.

        Please refer to following two screenshots to understand above steps,
        http://www.verydoc.com/images/err1314-1.png
        http://www.verydoc.com/images/err1314-2.png

        Please look at following page for the details about this setting,
        http://www.verydoc.com/exeshell.html

    3. Run following command lines to stop and restart "VeryPDF DocConverter COM Service",
        net stop "VeryPDF DocConverter COM Service"

        net start "VeryPDF DocConverter COM Service"
Step 4:
    Please use following example code to convert your HTML, DOC, DOCX, RTF, TXT, PPT, PPTX, XLS, XLSX, etc. files documents to PDF files,
     ASP Example:

    <%
        set PdfCreator = Server.CreateObject("PdfOut.PdfCreator")
        ConvertHTMLToPDF1 PdfCreator,"http://www.google.com","google001.pdf"
        set PdfCreator = nothing

        function ConvertHTMLToPDF1(byval PdfCreator, strHTMLFile, strPDFFile)
            'The first method to create a PDF file from HTML file
            strPDFFile = server.mappath(".") & "\" & strPDFFile
            dim strCommandLine
            strCommandLine = """" + strHTMLFile + """"
            strCommandLine = strCommandLine + " "
            strCommandLine = strCommandLine + """" + strPDFFile + """"
            strCommandLine = strCommandLine + " "
            strCommandLine = strCommandLine + """" + "paperType=6" + """"
            Response.write "HTML To PDF Command Line1 is: " & strCommandLine & "<br>"
            PdfCreator.Doc2PDFCommandLine(strCommandLine)
        end function
    %>
     PHP Example:
    <?php
        $url = "http://www.verypdf.com";
        $outfile = "C:\\test.pdf";
        $com = new COM("PdfOut.PdfCreator");
        $com->Doc2PDFCommandLine("\"$url\" \"$outfile\" \"paperType=0,PrintHTMLBackground=yes,overwrite=yes\"");
    ?>
    C# Example:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using PDFOUTLib;

    namespace FunWithVeryPDF
    {
        class Program
        {
            static void Main(string[] args)
            {
                try
                {
                    PdfCreator wert = new PdfCreator();
                    wert.Doc2PDFCommandLine("""http://www.google.com"" ""C:\temp\out.pdf""")
                    wert = null;
                    Console.WriteLine("Done");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
    }   
Step 5:
    You can convert .html, URL, .doc, .docx, .rtf, .ppt, .pptx, .xls, .xlsx, txt etc. files to PDF files from your ASP, PHP, C#, etc. program languages now.


Home | Products | Downloads | Support | Links | Contact

Copyright © 2000- VeryPDF.com, Inc. All rights reserved.
Send comments about this site to the webmaster.