Jordaan Mylonas
Jordaan Mylonas

Reputation: 1271

Image Quirk with PDF generated by WKHtmlToPDF

Using WKHtmlToPDF to generate PDFs for my company's web-based mapping service. Essentially, I take a template HTML file, inject an image into a div, save the HTML to disk and use WKHtmlToPDF to render to PDF.

Now, on most templates it works a treat. On one particular one though, where the image should be (int the pdf) is a grey area. HOWEVER, if I right click on the grey area, and select "Save Image As...", the saved image is correct.

Linked are the created PDF and the HTML on which it is based. Help required most urgently, and hints appreciated.

Zip File Containing HTML and PDF

Upvotes: 0

Views: 1089

Answers (2)

mt33
mt33

Reputation: 33

I was having an issue where a particular image was not being printed to the PDF. Other images on the same page were. The src of the missing image is from a CDN, but had no extension, i.e. src="\\path/to/image?param". Using the aforementioned -n switch (disable Javascript), the image shows up in the resulting PDF. Thanks Jordaan.

Upvotes: 1

Jordaan Mylonas
Jordaan Mylonas

Reputation: 1271

Don't know WHY this worked, but adding the "--disable-smart-shrinking" option, and/or removing the "-n"(Disable Javascript) option, fixed it.

Upvotes: 0

Related Questions