php - TCPDF - image displayed only once -


i'm trying generate multiple page pdf tcpdf version 6.0.010. script see below worked when using version 5.9.009.

every page has logo in it. pdf generated tcpdf version 6.0.010 shows once (on 1st page) logo. when load different images on these pages, images displayed correctly(as long there no duplicates).

    $pdf = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false);     $pdf->setprintheader(false);     $pdf->setprintfooter(false);     $pdf->setdefaultmonospacedfont(pdf_font_monospaced);     $pdf->setmargins(pdf_margin_left, 10, pdf_margin_right);     $pdf->setheadermargin(pdf_margin_header);     $pdf->setfootermargin(pdf_margin_footer);     $pdf->setautopagebreak(true, pdf_margin_bottom);     $pdf->setimagescale(pdf_image_scale_ratio);     $pdf->setfont('freesans', '', 18);     foreach ($items $item) {         $pdf->addpage();         $html = myhtmltemplate($item);         $pdf->writehtml($html, true, false, true, false, '');        }      $file = $pdf->output('mypdf.file', 's'); 

i have same problem work around load image base64 image string , use instead.

example:

$img= "myimage.jpg";  $imgdata = 'data: '.mime_content_type($img).';base64,'. base64_encode(file_get_contents($img));  $html = "<img src=\"$imgdata\"/>"; 

this should help, not fix , bit slower, works me. trust helps.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -