HTML Converter

How to convert HTML to PDF together with VC++ code?

       When you need to convert HTML file no matter online or local files to PDF from VC++ code, the following article will be quite helpful for you. Here I will introduce one software named VeryDOC Doc Converter COM, which is a COM object (or DLL Library, or Command Line), enabling developers to access the converter via any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. The main function of this software is that converting files like Microsoft Word, PowerPoint, Excel, JPG, PNG, GIF, and HTML to PDF and set some limitations. Please get more related information on homepage, in the following part, let us check how to use this software from one example.

Step 1. Free trial of Doc Converter COM

  • All the VeryDOC software is free downloading and trial including the COM version software. But when converting HTML to PDF by this software, please make sure you have the following application installed on your computer:
    PDFcamp V1.8 or newer, or PDFcamp Pro V1.8 or newer and Windows Internet Explorer 5.0 or newer.
  • When downloading finishes, there will be a zip file. You need to extract it to some folder then you can find code template and DLL Library.

Step 2. Convert HTML to PDF from  VC++ code.

  • When you open this software folder then you can find code templates of VB, VC and others. Please run this software according to the template and usage.
  • Here is one example for your reference.
    How do I call DocConverter COM from VC++ code?
    A: Please look at following VC++ function,
                    BOOL ConvertHTMLToPDF (const char *lpHTMLFile, const char* lpPDFFile)
                    {
                            IPdfCreator pdfout;
                            BOOL bRet = pdfout.CreateDispatch(_T("PdfOut.PdfCreator"));
                            if(bRet == FALSE)
                            {
                                    printf("Can't locate 'PdfOut.PdfCreator' in this computer, please reinstall this product to try again.\n");
                                    return FALSE;
                            }
                            pdfout.SetActivePrinter("PDFcamp Printer");
                            pdfout.SetFileName(lpPDFFile);
                            pdfout.SetHtml2PDF(lpHTMLFile);
                            pdfout.SetPaperType(0);
                            pdfout.CreatePDF();
                            while(pdfout.GetStillRunning() == 1)
                            {
                                    MSG msg;
                                    while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
                                    {
                                            TranslateMessage (&msg);
                                            DispatchMessage (&msg);
                                    }
                                    Sleep(20);
                            }
                            pdfout.DetachDispatch();
                            return TRUE;
                    }
    For more information, please read the "readme.txt" file in the "doc2pdf_asp" folder.

Please note when converting HTML to PDF, you need install the MS Internet Explorer 6.0 (MS IE6.0) to convert HTML files to PDF files, the MS IE5.0 and IE5.5 are not enough.  If you need to know more information, please check user manual. During the using, if you have any question, please contact us as soon as possible. 

DOC to Any Converter

How to create PDF from HTML file together with PHP?

   When you need to create PDF from any printable files like MS Word, PowerPoint, Excel, RTF, TXT, image, HTML, etc by some COM version software, software VeryDOC Doc Converter COM is a good choice. This software was developed for developers with some DLL Library, or Command Line, which enables you to call it together with Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. Please check more information on homepage, in the following part, let us check how to use this software.

Step 1. Download Doc Converter COM

When you use this software, please make sure you have the following software installed in your computer or else the conversion may fail.

  • PDFcamp V1.8 or newer, or PDFcamp Pro V1.8 or newer
  • Microsoft Windows 2000, XP, 2003, Vista, and 7
  • Windows Internet Explorer 5.0 or newer
  • Microsoft Office 97 or newer(when converting Office file to PDF)

When downloading finishes, it is a zip file. Please extract it to some folder then you can call it together with other applications.

Step 2. Create PDF from any printable files.

  • When you use this software, please refer to the usage and templates of this software.
  • Here I will share some code of creating PDF from online website together with PHP application.

How do I call DocConverter COM from PHP code?
A: Some examples for call DocConverter COM Service from PHP code:
Example 1:
                <?php
                        $url = "http://www.verypdf.com";
                        $path = "C:\\test.pdf";
                        $com = new COM("PdfOut.PdfCreator");
                        $com->html2PDF = $url;
                        $com->fileName = $path;
                        $com->Doc2PDFViaSocket();
                ?>
Example 2:
                <?php
                        $PdfCreator =new COM("PdfOut.PdfCreator") or die("Cannot start PdfCreator");
                        $PdfCreator->Doc2PDFCommandLine(' "c:\input.doc" "c:\output.pdf" ');
                        $PdfCreator = null;
                ?>
Example 3:
                <?php
                        $url = "http://www.verypdf.com";
                        $path = "C:\\test.pdf";
                        $com = new COM("PdfOut.PdfCreator");
                        $com->Doc2PDFCommandLine("\"$url\" \"$path\" \"paperType=0,PrintHTMLBackground=yes,overwrite=yes\"");
                ?>

By this software, you can also fulfill the following functions:

  • When creating PDF from HTML file, you can set input document filename or a URL point to a website. You also can set input content from a buffer, this function only can work for a html stream,please notice, you can't use "html2PDF" and "htmlBuffer" in one time.
  • Set page header in the PDF file, it only available when "headersFooters" equal "on".
  • Set page footer in the PDF file, it only available when "headersFooters" equal "on".
  • When creating PDF, you can also specify the page type like the followings:
  • Set page type, the value is from 0 to 9,
        0 "Letter [8.5 x 11 in]",
        1 "Legal [8.5 x 14 in]",
        2 "Executive [7.25 x 10.5 in]",
        3 "Ledger [355.6 x 215.9 mm]",
        4 "Tabloid [11 x 17 in]",
        5 "Screen [10 x 7.5 in]",
        6 "A3 [297 x 420 mm]",
        7 "A4 [210 x 297 mm]",
        8 "A5 [148 x 210 mm]",
        9 Custom page size

There are two many functions and examples of this software, I can not list all of here. During the using, if you have any question, please contact us as soon as possible.

DOC to Any Converter

Failed to call doc2any.exe from Java application to convert PPTX and DOCX files to PDF files

Hi,

I am from XXXXXXXXXX and using verydoc.exe production license.

I got the following log while i was running the very doc command from java application deployed on server.

We run the command from java application as given below,

1. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "FILENAME.pptx" "FILENAME.pdf"

2. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug -runasuser -runaspwd "FILENAME.pptx" "FILENAME.pdf"

with 2nd command we are able to convert the files till 17th July 2013 but unfortunately now it is not working now.

Please find the log below

Check license information...
Thank you for choosing 'VeryDOC DOC to Any Converter' product.
Check utility functions...
Start the conversion...
FILENAME.pptx ==> FILENAME.pdf
Convert PowerPoint document to other formats...
Loading "FILENAME.pptx" file...[20%]
ReportError: PowerPoint could not open the file.
Shutdown PowerPoint Application...[60%]
[FAILED] Failed by SaveAs function in MS PowerPoint application.
Prepare to convert "FILENAME.pptx" file...[10%]
Loading "FILENAME.pptx" file...[20%]
ReportError: PowerPoint could not open the file.
Shutdown PowerPoint Application...[60%]
[FAILED] Can't locate EMF files.
[FAILED] Failed by Render to Metafile function in MS PowerPoint application.
Convert OpenOffice Documents to other formats by OpenOffice: 'FILENAME.pptx'=>'FILENAME.pdf'
[FAILED] Can't retrieve OpenOffice information (shell\open\command) from registry.
[FAILED] OpenOffice does convert this PowerPoint document failed.
Try convert document continue (1)...
Try convert document continue (2)...
Conversion time = 2013ms
FILENAME.pptx ==> FILENAME.pdf, result=ERROR
TickCount = 2013ms(2.01s), Result = 0

Thanks & Regards
Customer
---------------------------------------------------------
Please use full path to try again, can you work fine with full path? for example,

C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "D:\FILENAME.pptx" "D:\FILENAME.pdf"

VeryDOC
---------------------------------------------------------
Hi,

In my ticket I already mentioned I tried with 2 options given below but no luck. Can you please suggest us to work this command.

1. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "FILENAME.pptx" "FILENAME.pdf"

2. C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug -runasuser -runaspwd "FILENAME.pptx" "FILENAME.pdf"

Thanks & Regards

Customer
---------------------------------------------------------
Please use full path for input and output filenames to try again, for example,

C:\OpenText\doc2any_cmd\doc2any.exe -$ < License key> -debug "D:\FILENAME.pptx" "D:\FILENAME.pdf"

for example, you can put FILENAME.pptx to D:\ folder, and run above command line to try again.

Can you work fine with full path?

VeryDOC
---------------------------------------------------------
Dear support Team,

With the given command below I can execute in command prompt on the server where verydoc is placed and I can see the output pdf file. My problem is I have deployed my code on server and want to convert office documents to pdf file.

In my commands every time am giving the full path for input and output filenames to convert, here am facing the problem as I mentioned from my first email.

Please let me know if you need more info.

Thanks & Regards

Customer
---------------------------------------------------------
You need set MS Word DCOM run inside an interactive user account instead of default system user account, please look at following web pages for more information,

https://www.verydoc.com/blog/cannot-test-doc2any-on-net.html

Please arrange MS Word DCOM run from an interactive user account, please refer to following web page,

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

"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.

The following web pages will useful to you too,

https://www.verydoc.com/blog/how-to-call-doc-to-any-converter-sdk-from-asp-net-source-code.html

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

http://www.verypdf.com/wordpress/201109/doc2any-sdk-dll-does-work-on-localhost-but-not-work-on-internet-2333.html

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

https://www.verydoc.com/blog/run-doc2any-on-windows-2003-or-windows-2008-system.html

https://www.verydoc.com/blog/how-to-call-doc2any-from-php.html

We have also a VeryPDF Cloud API Platform, this is a Cloud Service to convert online office documents to PDF files, please look at following web pages for more information,

http://www.verypdf.com/online/cloud-api/user-guide.html
http://online.verypdf.com/api/

VeryPDF Cloud API Platform is a cloud service, all conversion will be done on our servers, you needn't install any software to your server in order to convert office documents to PDF files.

VeryDOC

DOC to Any Converter

How to convert word to PDF from ASP program?

  In this article, I will show you how to covert Word document to PDF from ASP program. The software I use is named as VeryDOC Doc Converter COM, by which you can convert any printable documents to PDF files, convert dynamic HTML pages and URLs to PDF files conversion (include Java Applet, SVG, Flash, Javascript, iFrame, etc.) and others. And this software can be used to be integrated COM object (or DLL Library, or Command Line), which makes developers develop software via any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc.  Please check more information on homepage, in the following part, let us check how to use this software.

Step 1. Download Doc Converter COM

  • All the VeryDOC software is free trial and free downloading, so you can evaluate it without any payment charged. When you use this software, please make sure your computer satisfy those requirements: PDFcamp V1.8 or newer, or PDFcamp Pro V1.8 or newer installed, Microsoft Windows 2000, XP, 2003, Vista, and 7 later version installed.
  • When downloading finishes, there will be a zip file. Please extract this file to some folder then you can run this software according to the usage and examples.

Step 2. Convert word to PDF from ASP program.

  • The following code is from the extracted folder examples, which can help you call this software from ASP quickly and accurately.
  • Here are some examples, please run the conversion following the following steps.

A: Please by following steps to try,
1. Please run "install_as_exe.bat" to install the DocConverter COM first, and make sure the "doc2pdf_service.exe" application is running,
2. Please make sure that you have already installed "PDFcamp Printer" before,
3. Please run following ASP examples to try,
Example 1:
                <%
                        set PdfCreator = server.createobject("PdfOut.PdfCreator")
                        PdfCreator.html2PDF= "http://www.google.com/"
                        PdfCreator.fileName = "C:/google.pdf"
                        result = PdfCreator.Doc2PDFViaSocket()
                        set PdfCreator = nothing
                %>
Example 2:
                <%
                        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
                %>
4. Then you can convert .html, URL, .doc, .docx, .rtf, .ppt, .pptx, .xls, .xlsx, txt etc. files to PDF files from your ASP code.

There are more examples in extracted folder and user manual, please check details there. During the using, if you have any question, please contact us as soon as possible.

PCL, PS, PDF Page Counter

Speed for Spool File Page Counter SDK software

For Spool File Page Counter SDK product,

https://www.verydoc.com/spool-page-count.html

VeryDOC support,

I have been evaluating your PDF Parser & Modify SDK for .NET download (ps-and-pcl-info-sdk.zip) as a solution to identify PDF files containing color from PDF files that are 100% Black & White. By redirecting the console to a file I can subsequently process with a reader routine it appears your product has a means of providing the information we need. I also notice on your product website that the DLL files can be integrated into our own applications. After downloading and testing I have 3 issues on which I would like feedback if you don't mind.

1. Execution time: When I run a test using the on a workstation running Windows 7 Enterprise SP1 64 bit on Intel Core i5-3550 @ 3.3 GHz processor (4 CPUs) with 4 GB RAM each PDF was taking 3-5 seconds to output info to the console with the most common time being 4 seconds. Running the same test on a server running Server 2008 R2 Standard SP1 64 bit on Intel Xeon X5650 @ 2.67 GHz 2 processors (24 CPUs) with 24 GB RAM each PDF was taking 2-3 seconds to output info to the console with the most common time being 2 seconds. The issue is that on a given application run we may have 5,000 or more PDF files to identify as color or black and white only and our processing window only allows a maximum of 1.5-2 hours to get that part done. Even at an average of 2 seconds per PDF file the time required is 10,000 seconds or about 2.8 hours. I know that looking for color directives in PDF is not a trivial task. Do you have any suggestions how to get faster throughput on the program to where the rate is an average of 1 PDF file per second? I am also wondering if integrating your dll objects into our applications will have a tendency to speed up or slow down the throughput experienced with the examples in the software download.

2. Integration with our apps: In an attempt to connect to namespace properties and methods in your product from a Visual Studio 2008 project I get a message that the dll files were not built in a way that exposes those objects for linking with software I develop. I can write the project to run a DOS shell that executes your program and then retrieve the log but your website indicates that the functionality of your program can be integrated into our own applications.

3. Server vs Developer: I first downloaded what the server version download button downloads and that is what I used in testing execution time because of pricing and using a robust server situation to process is most likely what we would be setting up. When I could not get the DLLs to link with a sample VS2008 program I created I considered that maybe the developer version has exposed DLLs. So I click the download button for the developer version and what was downloaded is identical to what the server download button downloaded. I did not go any further. Are there special mechanics involved when linking your DLL files to our applications. I want to be sure the performance and .NET linking of DLL files are achievable before I can consider recommending a purchase.

Thanks for your time and response to my questions. I look forward to hearing from you soon. My phone # is below if you think it would be better to share a verbal dialog.

Customer

----------------------------------------------------

>>1. Execution time:

The speed of our Spool File Page Counter SDK (ps-and-pcl-info-sdk) is already fast enough, it is need only 2 seconds per file. However, I have following solution to you if you wish improve the speed continue,

Multiple Processes:
You can run several instances of ps-and-pcl-info-sdk to check the color information of your PDF pages, multiple processes will utilize multiple core CPU completely, this will improve the speed for multiple files a lot.

You can also send to us some PDF files for checking, we will try to figure out a best solutions for your PDF files in order to improve the speed.

>>2. Integration with our apps

ReadInfo.dll is a 32bit DLL Library, it is not a COM component, you can call ReadInfo.dll from your source code directly, but you can't add a reference to it, please understand.

Also, ReadInfo.dll is a 32bit DLL Library, when you call it from your code, you need compile your source code with x86 compile option, if you compile your source code with x64 or AnyCPU on 64bit system, you can't call it properly, you will get "incorrect image format" error.

>>3. Server vs Developer:

Yes, you can call ReadInfo.dll from .NET code without any problem, you need call ReadInfo.dll from your .NET code directly and compile your code with x86 platform mode.

VeryDOC

----------------------------------------------------

Thank you for the prompt response. The information you provided resolves my issues. I was able to call your product functionality from a simple .NET program and while I have not attempted a throughput test of multiple programs running concurrently to use more of the available cores it makes sense that doing so should result in an overall throughput increase.

Customer