Praveen Dabral
Praveen Dabral

Reputation: 2509

TCPDF html with image not working

I'm working on creating pdf with TCPDF library, i'm having issue creating pdf from html with image.

Pdf creation is worked beautifully in my localhost and staging server but when i moved it to live enviornment it fails to load and throwing error.

ErrorException in tcpdf.php line 7124:Illegal string offset 'masked'

I've applied googled answers but none worked for me.

When i'm removing the image from html, pdf is generating. But when i'm adding image, its throwing the above error.

I've checked the image url and its fine. Its been one whole day with no results.

It would be very helpful if someone can lead me to right way.

CODE

 $pdf = new \TCPDF();
 $pdf->SetPrintHeader(false);
 $pdf->SetPrintFooter(false);

 $pdf->AddPage();
 $pdf->writeHTML(view('pdfs.order',$data)->render());

 $pdf->Output($filename, 'D');

HTML

<img width="320" height="68" src="{{ url('').'/img/report/large_logo.png' }}" />

Upvotes: 1

Views: 4665

Answers (1)

Praveen Dabral
Praveen Dabral

Reputation: 2509

So at the end i was able to solve it and i would like to share it with you guys.

Real reason was transparent png images.

At first i tried to find a solution that handle transparent images by TCPDF library, but didn't got anything working.

At the end i've replaced the transparent png images with non transparent images and it worked.

Hope it help someone.

Upvotes: 2

Related Questions