spipu/html2pdf

Insufficient Data for an Image - Adobe Acrobat

RWAP opened this issue · 1 comments

RWAP commented

We have been using this plugin for a while, but today we got an error when opening a generated PDF in Adobe Acrobat Reader "insufficient data for an image".

The PDF opens fine in Firefox and Chrome browsers. just not in Acrobat Reader.

RWAP commented

Looking at Html2Pdf.php, I grabbed the problem images being written with:

$this->pdf->Image($src, $x, $y, $w, $h, '', $this->_isInLink);

The image data passed here are (which looks ok)

https://res-2.cloudinary.com/dtf2gwjcg/image/upload/c_fill,dpr_3.0,g_auto:no_faces,h_230,q_auto,w_230/la9nzqwooycoe2ikxs2e.jpg, 13.469583333333, 133.35383333333, 20, 20, '', false
https://res-5.cloudinary.com/dtf2gwjcg/image/upload/c_fill,dpr_3.0,g_auto:no_faces,h_230,q_auto,w_230/youjpjfambqfwqjzlw2o.jpg, 13.469583333333, 170.094625, 20, 20, '', false
https://res-2.cloudinary.com/dtf2gwjcg/image/upload/c_fill,dpr_3.0,g_auto:no_faces,h_230,q_auto,w_230/r7hd0ruh7d1rov29ehol.jpg, 13.469583333333, 200.22891666667, 20, 20, '', false

I fixed it by altering the line to force resze:

$this->pdf->Image($src, $x, $y, $w, $h, '', $this->_isInLink, '', true);