barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.74k stars 971 forks source link

Can't embed PNG as base64 #116

Closed jopacicdev closed 6 years ago

jopacicdev commented 9 years ago

Hey, I'm trying to embed a base64 value of PNG image into the document, via:

<img src="{{ $sig }}" /> where $sig = 'data:image/png;base64,iVBORw0K.......'

But this gives me a large X-box with message:

Data-URI could not be parsed
data:data:image/png;base64,iVBORw0KGg..........

How can I display embedded images in PDF, without having to actually upload the somewhere?

ebarriosbloonde commented 9 years ago

My solution :) (you must change - by < >. I can't write this character here) <?php $mime='image/png'; ?>

-img src="<?php echo 'data:' , $mime , ';base64,' , base64_encode($image); ?>"-

GaurangGhinaiya commented 8 years ago

@ebarriosbloonde

Image not found or type unknown when i try to load image as base46 i am getting this in pdf

Asimov500 commented 7 years ago

I am also getting the same problem. Have you managed to sort it. I am loading images from outside the root folder and need this to work.

andrespaz1991 commented 7 years ago

Lo único que se puede hacer es enviar desde otro formulario por medio de POST aquí una explicación más clara https://stackoverflow.com/questions/37328139/is-it-possible-to-export-a-google-chart-using-dompdf

jopacicdev commented 6 years ago

Since the error says:

Data-URI could not be parsed
data:data:image/png;base64,iVBORw0KGg..........

You should probably omit one 'data:' and it will render fine.

tripexito commented 4 years ago

Hi, I am having issues to download pdf file generated with png images, in chrome download dialog shows as .html instead of .pdf

image

image

I've been trying using images as base64 and its working the pdf file download in chrome but the images does not showing on pdf file downloaded. In Firefox Pdf Viewer there's no issues. Please tell how can I solve. Thanks.