Can't convert html to pdf

Product: PDFTron

Product Version: PDFTron Java - v9.1.0

Please give a brief summary of your issue:
Can’t convert HTML to pdf in container

Please describe your issue and provide steps to reproduce it:
I have a simple code to convert HTML to pdf and it works when running in my machine (linux), but when I run it in a docker container using openjdk:8 image it won’t work. I have configured the html2pdf modules and set permission for read/write/execute, and there isn’t any exception or error even when using the getLog() method from HTML2PDF it just returns an empty string.

PDFNet.initialize(LICENSE_KEY);
HTML2PDF.setModulePath(MODULE_PATH);
PDFDoc doc = new PDFDoc();
HTML2PDF converter = new HTML2PDF();
htmlConvert.insertFromHtmlString("<html><body><h1>Heading</h1><p>Paragraph.</p></body></html>");
converter.convert(doc);

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Most likely this is a dependency issue. What exact Linux distro are you using in your Docker container?

It’s using Debian GNU/Linux 11

Another thing I’ve noticed is that when it works, it prints in the log:

Permission: html2pdf
Permission: write

but when not it just print:
Permission: html2pdf

Currently we just have Debian9 and Debian10 builds. Do either of these work for you?

https://pdftron.s3.amazonaws.com/custom/ID-zJWLuhTffd3c/support/html2pdf/0.12.6/HTML2PDF-Debian10-Buster.tar.gz

https://pdftron.s3.amazonaws.com/custom/ID-zJWLuhTffd3c/support/html2pdf/0.12.6/HTML2PDF-Debian9-Stretch.tar.gz

If you are having issues you can simply call to see what the missing dependency is.

ldd html2pdf.so

Thank you, that helped me identify the missing packages and now it works

I had this very same issue and was also able to identify some missing dependencies but after installing them I get another error:
Missing output file /tmp/pdftron/Trn-1-1647609886-0c96d1ca-e9b1-40ec-b0b3-59baf8e312b3

I saw another post suggesting that this could be related to execution rights on the html2pdf_chromium.so but this is not the case. It has full execution rights.
Can you please help?

Please note that we have released a new major update to our HTML2PDF module.

I suggest updating to latest PDFNet 9.2 SDK and latest HTML2PDF module.

Hi Ryan
I was already using the latest version of the SDK and have tried downloading the latest version of the conversion module to no avail.
I still get the same error.
Any ideas?

Would you be able to provide the latest error message that you get?

I set up a test container to check the dependencies for the HTML2PDF module using the openjdk:8 image and checked for missing dependencies. The following is a list of missing dependencies for this image that must be installed for the module:

bash-4.4# ldd html2pdf_chromium.so | grep “not found”
libnss3.so => not found
libnssutil3.so => not found
libnspr4.so => not found

You may also need to install fontconfig.

Bruce Tompkinson