HTML to PDF conversion fails with large files


Product Version:

HTML to PDF conversion failing

Using the code exactly as it is in sample 4 from that link and also setting the timeout to 1200000 which is approximately 3 hours and 20 minutes.

settings := pdftron.NewWebPageSettings()
settings.SetTimeout(120000 * 100)

The conversion fails after about an hour when trying to create a PDF with over 3000 pages from html string. The only message after failing that is printed in the console is:

Conversion failed. HTTP Code: 0
Missing output file /var/folders/vf/nds_73vn6hqfcm33jtlz7bj80000gn/T/pdftron/Trn-45350-1673012661-ef11cfd6-55f4-45da-aa08-ca539cd163c0

Does somebody have an idea why this might be happening? It works fine with around 2000 pages.

The HTML to PDF module uses Chromium headless, so the first step would be to open your 3000 page HTML content in Chrome and try printing. Is that time any different that using PDFNet SDK? How long are you seeing Chrome print taking?

Hey Ryan, we’ve tried what you suggested and it successfully created a 3000 pages pdf in print mode. It took around 20 minutes. We’ve came to the conclusion that HTML2PDF PDFTron library fails on 2350 pages (2300 is successful). Also tried around 2300 and 2350 inside Chrome in print mode and it successfully created pdfs:

  • 2300 - 8 min 40 sec
  • 2350 - around 9 minutes

Just for reference, this is a Chromium related issue and is currently worked on: