Convert a very long HTML file to PDF

Dear Verypdf Support Team,
attached you find a html and a pdf File which I generated with following command line:
C:\TEMP\MMAITS\HTMLShell\htmltools.exe -$ "XXXXXXXXXXXXXX" -playemf2 -emfheight 1125 -margin 20x20x20x20 -wtext "Test Watermark" -wh 12 -wx 210 -wbox "0,0,500,10" -wc "FF0000" "C:\TEMP\TestHTML.htm" "C:\TEMP\TestHTML.pdf"

The problem is, that the conversion always stop after 1306 lines, equals 20 pages at the PDF File (see html and pdf file). Is this a error of your conversion tool, or do I have to use different parameters to get all data from the HTML converted?
Please let me know, when I can expect a answer of my problem.
===============================

Because this HTML file is too long, htmltools.exe can't convert so long HTML file to PDF file properly, this is a limitation of Render engine of IE Control. However, we have another solution to you, you can download our HTMLPrint to Any Converter Command Line from following URL to try, HTMLPrint to Any Converter Command Line is able to convert any length HTML file to PDF file properly,
http://www.verydoc.com/htmlprint2any_cmd.zip

after you download and unzip it to a folder, you can run following command line to convert your HTML file to PDF file,

html2any.exe -printtopdf D:\temp5\TestHTML.pdf D:\temp5\TestHTML.htm

You can hide the printing preview dialog by "-hidewindow" option,

html2any.exe -hidewindow -printtopdf D:\temp5\TestHTML.pdf D:\temp5\TestHTML.htm

if you encounter any problem with HTMLPrint to Any Converter Command Line, please feel free to let us know.

VeryPDF
=============================== 

thank you for your fast response.

I can't agree with your explanation.
For our application Software I use the same IE Control to display the HTML file and I never found any limitation within this engine.
If the Internet Explorer Control had any limitation, it would be not possible to display all 2000 lines of the HTML file, too (see HTML file from last mail).

Could you please give me a different solution of this problem.
========================================
Yes, IE Control can display and print long HTML file without any problem, but it can't render the long HTML file to a memory metafile properly, maybe it is caused by memory limitation in IE Control, this problem is exist in ::Draw() function of IE Control, we had worked on this problem long time, but no luck.

Yes, we have other solutions to you, htmltools.exe does support "-html2pdf2" option, you can use this option to convert long HTML file to PDF file, for example,

htmltools.exe -html2pdf2 D:\temp5\TestHTML.htm D:\temp5\TestHTML.pdf

"-html2pdf2" option does analyse HTML directly, it doesn't call ::Draw() function of IE Control to render long HTML to a memory metafile, so it is support long HTML file.

"-html2pdf2" option is not support "-wc" parameter yet, you can run following command line to add the watermark to your PDF file without "-wc" parameter,

htmltools.exe -$ "XXXXXXXXXXXXXXXXX" -playemf2 -emfheight 1125 -margin 20x20x20x20 -wtext "Test Watermark" -wh 12 -wx 210 -wbox "0,0,500,10" -wc "FF0000" -html2pdf2 D:\temp5\TestHTML.htm D:\temp5\TestHTML.pdf

we hoping "-html2pdf2" parameter will work fine to you, please to try.

VeryPDF

======================================

Thank you for the support.
The "-html2pdf2" parameter worked for the simple example very good.

For the final HTML file with data, images and colored Text it doesn't work quiet good. The normal text is displayed in big colored letters.
See the 2 files attached.
Is the new "-html2pdf2" parameter not valid for colored Text like the Watermark, or do I have to use different parameters?

I used your posted calling sequence

htmltools.exe -$ "XXXXXXXXXXXXXXXXX" -playemf2 -emfheight 1125 -margin 20x20x20x20 -wtext "Test Watermark" -wh 12 -wx 210 -wbox "0,0,500,10"  -html2pdf2 D:\temp5\TestHTML.htm D:\temp5\TestHTML.pdf

to create the pdf File.
==============================
Your HTML file is contain mismatch tags, for example,

This is the original HTML code,

~~~~~~~~~~~~~~
<p align=CENTER><b><tt><font size=5.5em><font color="#FF8000">&nbsp;Flight No.: 1</tt></b></p>
~~~~~~~~~~~~~~

This code is contain two <font> tags, but it doesn't contain "</font>" tags, you need use </font> tag to end the font tag, please modify it to following code,

~~~~~~~~~~~~~~
<p align=CENTER><b><tt><font size=5.5em><font color="#FF8000">&nbsp;Flight No.: 1</tt></b></p>
</font>
</font>
~~~~~~~~~~~~~~

Then you can use "-html2pdf2" parameter to convert this HTML file to PDF file correctly.

Also, "-html2pdf2" parameter doesn’t support color watermark yet, we are planning add this minor function into the next version of htmltools.exe application, we will let you know after new version is available. In the meantime, you can insert the demo watemrark into original HTML file before conversion, "-html2pdf2" parameter will convert this demo watermark into output PDF file too.

VeryPDF 

==========================================
now it is working. Thank you for your help! I'm just curious, where is your office located?

You are right, the HTML Tag for the Font was missing. I generate the HTML file during the application automatically and I forgot the closing Tag.

With the Watermark, I can survive with the black letters.

Just a note for you. With the "-html2pdf2" parameter the text for the watermarks is a little faulty.

For Example:
"TextTextTextTextTextTextTextText" is ok, Pdf File is generated

"Text Text Text Text Text Text Text Text" no Pdf File is generated!

Anyway maybe you know that already.


One more question: Is there a possibility with your Tool to add pagenr. into the converted PDF file?
==========================================

>>With the Watermark, I can survive with the black letters.
>>Just a note for you. With the "-html2pdf2" parameter the text for the watermarks is a little faulty.
>>For Example:
>>"TextTextTextTextTextTextTextText" is ok, Pdf File is generated
>>"Text Text Text Text Text Text Text Text" no Pdf File is generated!
>>Anyway maybe you know that already.

Thanks for your message, we will research these problems shortly, we will include the fix for this problem into the next version of htmltools.exe, we will let you know after new version is ready, thanks for your patience.


>>One more question: Is there a possibility with your Tool to add pagenr. into the converted PDF file?

Thanks for your message, what is your meaning for the "pagenr"? do you wish add the page number to each page in PDF file?

VeryPDF
==========================================
ok therefore I receive your mail this early in the morning.

Yes it would be good, if I can add the pagenr on every page in the PDF, like the watermark, only as a footer.
==========================================
Thanks for your message, htmltools.exe hasn't an option to add the page number to each page yet, however, your suggestion is great, we will try to implement this function in the future releases.

VeryPDF

 

 

 

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

One Reply to “Convert a very long HTML file to PDF”

  1. You can also use docPrint Pro to convert a long HTML file to PDF file, docPrint Pro can be downloaded from this web page,

    http://www.verypdf.com/app/document-converter/try-and-buy.html#buy_pro
    http://www.verypdf.com/artprint/docprint_pro_setup.exe

    after you download it, you can run following command line to convert your long HTML file to PDF file properly,

    “C:\Program Files (x86)\docPrint Pro v7.0\doc2pdf.exe” -i “http://www.verypdf.com/artprint/index.html” -o D:\downloads\output.pdf -s PrintHTMLBackground=1 -s ShowHTMLStatusBar=1 -l 10000 -s timeout=60000

    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 to VeryPDF Cancel 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!