Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

PDF with Image #12

Closed
MansurAje opened this issue Sep 5, 2013 · 12 comments
Closed

PDF with Image #12

MansurAje opened this issue Sep 5, 2013 · 12 comments

Comments

@MansurAje
Copy link

how to add Image to PDF generated ??

@thujohn
Copy link
Owner

thujohn commented Sep 5, 2013

Hi.

You need to activate DOMPDF_ENABLE_REMOTE
If you haven't published the config :

php artisan config:publish thujohn/pdf

Add simply this :

<img src="'.asset('your-image.jpg').'" alt="" />

@thujohn thujohn closed this as completed Sep 5, 2013
@MansurAje
Copy link
Author

i had try {{ HTML::image('assets/img/$visitor->id.jpg', 'alt-text')}}
or like you suggest

but its to long to download file pdf generated, and download time out..
DOMPDF_ENABLE_REMOTE also i change true...,

@thujohn
Copy link
Owner

thujohn commented Sep 8, 2013

If download is long maybe you have another problem (server, image...).

I tried but had no problem with download time.

@MansurAje
Copy link
Author

image still not show, in my pdf image not readable or empty ?

if i show in my view its work fine.. but in pdf get error like that

@thujohn
Copy link
Owner

thujohn commented Sep 19, 2013

Can you start a new project ?

Route::get('/', function()
{
    $html = '<html><body>'
            . '<p>Test image</p>'
            . '<img src="'.asset('Logo-Laravel.png').'" alt="" />'
            . '</body></html>';
    return PDF::load($html, 'A4', 'portrait')->show();
});

For me it is instantaneous.

@Burnett01
Copy link

for me too, works fine 👍

@MansurAje
Copy link
Author

Call to undefined function imagecreatefrompng()

/srv/1/sysadm/mansur/laravel/l4test/vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/lib/class.pdf.php

$imgtmp = @imagecreatefrompng($file);
if (!$imgtmp) {
return;

i get error again

@thujohn
Copy link
Owner

thujohn commented Sep 20, 2013

@MansurAje
Copy link
Author

how to check GD is enable ?

@thujohn
Copy link
Owner

thujohn commented Sep 23, 2013

@rossedman rossedman mentioned this issue Oct 2, 2013
@tskkh
Copy link

tskkh commented Sep 4, 2014

Hi thujohn,
I already enable GD and enable 'DOMPDF_ENABLE_REMOTE' => true, but i still can not add image to my pdf file. and in pdf file downloaded, it contains the text that "DOMPDF_ENABLE_REMOTE is set to FALSE ". I do not know why because i alreay enable it.

Please help !

@jeanfbs
Copy link

jeanfbs commented Jun 19, 2015

Hi thujohn, I could not put image in the PDF document, followed all the tutorials I could find but it still generates an error 'file_put_contents ()'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants