Reputation: 140
We are currently generating a PDF from HTMLcontent using the wkhtmltopdf tool. During PDF generation, we are facing the issue that images are not printed after near 40+ images.
I have attached an HTML file we have used and also attached generated PDF as well.
The command we have used is as below: Command=wkhtmltopdf --orientation portrait --zoom 1.3 --margin-top 10 --margin-bottom 10 --load-error-handling ignore Test-HTML.html Test-PDF.pdf
wkhtmltopdf version: wkhtmltopdf 0.12.6 (with patched qt)
We need a solution in the case of a large number of files. How can we manage PDF generation and take care of blank images?
Issue PDF output:
Html file sample, please add rows almost 50+:
<meta charset="UTF-8"><!DOCTYPE html>
<html>
<head>
<title>TEST</title></head>
<body>
<table>
<tr>
<td><img src="https://images.pexels.com/photos/268533/pexels-photo-268533.jpeg"
style="width:270px;height:300px;"/></td>
<td>
</td>
<td><img src="https://images.pexels.com/photos/268533/pexels-photo-268533.jpeg"
style="width:270px;height:300px;"/></td>
</tr>
</table>
</body></html>
Upvotes: 0
Views: 790
Reputation: 11821
As far as I can tell there should be no problem.
For confidence test I downloaded almost 100 of your designated sample (268500-208599) , you will see 2 images in that range are not available thus total of 98 true high quality images including up to 7032 pixels x 3956 pixels as those thumbnails in printout.
NOTE the PDF will NORMALLY use ALL those jpg pixels at full lossy quality = PDF of 266,024,491 bytes, but WkHTMLtoPDF will reduce/rescale many of them down, say by 1/3rd or so (Most including the 7032 x 3956 pixels are disproportionately reduced to 1756 x 1949, thus a distorted reduced quality output file = 73,889,894 bytes. and unexpected as to how many are reduced !!
I used as shown in your example code, two table divisions per row, in the HTML (calling same image twice). However I would expect in your own files there would be 200 different images.
The gaps in the layout are due to lack of style, which would normally produce 34 pages not 44, but that is not the issue here.
So both local and remote files are identical in size, with identical expected fails and identical results.
Thus either
Upvotes: 0