Hi jrbeeman,

thanks for implementing dompdf in Drupal.

I have just a small question. It's more about dompdf than about your module, so I hope it's ok to ask this here.

I'm writing an own module and want to print an image to the PDF. So I write

global $base_url;
$html = '<img src="'.$base_url.'/files/myimg.jpg">';
dompdf_stream_pdf($html, 'pdf', $directives);

But it doesn't work.
I also tried it with

global $base_url;
$html = '<img src="/files/audio_zenit.jpg">';
$directives = array(
      'set_base_path' => $base_url,
);   
dompdf_stream_pdf($html, 'pdf', $directives);

Same problem. It always shows just the broken_image.png Image

Text output etc. works well.

Any ideas?

Thanks a lot!
Mic

Comments

mhuebl’s picture

Status: Active » Closed (fixed)

Hmpf.

It works with the absolute server path like

global $base_url;
$html = '<img src="'home/myname/sth/sth/files/myimg.jpg">';
dompdf_stream_pdf($html, 'pdf', $directives);

That doesn't seem to be the best solution for me. So I'm happy about other solutions