HTML2PDF and PrintHTMLBackground=yes

running the command line:
html2pdf "%CD%\testbackground03.htm" "%CD%\testbackground03.pdf" "PrintHTMLBackground=yes,KillProcess=no,doc2pdf_service=yes"

The tool is installed as a service.

The pdf file does not have the background color as specified in the original html file.  I have attached both the html file and the generated pdf file.

Here is an image captured of the html file when viewed in IE 8.0:

Here is an image captured of the pdf file when viewed in Adobe Acrobat Professional 6.0:

The command line parameter “PrintHTMLBackground=yes” does not seem to work.  I have tested changing the background color as well as setting a background image – neither background is generated into the pdf file.
================================
Please look at attached screenshot, you can select “Print background colors and images” option in IE to try again, we hoping this solution will work fine to you.

VeryPDF
================================
I have already tried setting that option in IE.  See the attached images.
It does not make HTML2PDF generate a PDF with the background image or color.
================================
The issue is that doc2pdf.exe is running as a service, and that service is using the “Local Account” credientals.
The local account’s IE setting for “Print_Background” needs to be set to “yes”.

I edited the “Print_Background” registry key at HKEY_USERS\.DEFAULT\Software\Microsoft\Internet Explorer\PageSetup to be “yes” and re-ran one of my test html files.  This causes the background image of the html page to correctly appear in the generated PDF.

It would be nice to have the command line parameter “PrintHTMLBackground” setting temporarily set the IE “Print_Background” registry setting to match the command line parameter just while the single job is being converted.
================================
Thanks for your message, “PrintHTMLBackground” option will set the IE “Print_Background” registry in the current active user account, but your doc2pdf.exe is run inside “Local Account”, so the IE which called by doc2pdf.exe can’t read “Print_Background” registry item properly, this is the reason of this problem, we will try to solve this problem in the future releases.

However, your solution is great, your solution will helpful for our other customers in the future, thank you.

VeryPDF

VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: +1 (from 1 vote)
HTML2PDF and PrintHTMLBackground=yes, 10.0 out of 10 based on 1 rating

Related Posts

This entry was posted in DocConverter COM and tagged . Bookmark the permalink.

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!