bauhausjs / phantom-html2pdf

Node module to generate PDFs from HTML via PhantomJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Many images on html - not all loading and showing in generated pdf

MadaManu opened this issue · comments

Hi,
It's my first time using phantom-html2pdf. I am dynamically generating html file based on a set of objects from the database. For each object a new table row is generated with one of the columns containing a img tag with the source of the image being on the web (s3).

The pdf gets generated, however only about 50 of the rows contain the images loaded and displayed in the generated pdf. There are about 1k+ rows with each having an image. The rest of the rows do not show any image. Is there something that I can do to enable the pdf generation to load each and every image referenced in the html?

*Note: the generated html opened by a browser does load every image (so it is not an issue with the images not existing).

I have used the delay (on the page options) - I multiply the number of total rows that I know are in the table (the amount of images) by a randomly picked number (10) and seems that in most cases it allows enough time for the images to load.

Not sure this is the best way to go forward as this does not ensure that all images will be loaded in the set delay.

Hi, sorry I am not aware of a better solution.