Menu

Image not displayed with writeHTML

Help
tampe125
2012-12-04
2012-12-05
  • tampe125

    tampe125 - 2012-12-04

    Hi, I'm having some troubles on displaying images on a PDF.
    This error is quite weird, since it only happens on my live site, on localhost (windows) everything is fine.

    I have an html code that I use as template, then I write the PDF using the writeHTML syntax.
    This is the PHP code:

    $pdf->SetMargins($params->get('pdfMarginLeft', 15), $params->get('pdfMarginTop', 27), $params->get('pdfMarginRight', 15));
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    $pdf->SetFont('helvetica', '', 8);
    $pdf->AddPage();
    
    $pdf->writeHTML($html, true, false, true, false, '');
    
    $pdf->lastPage();
    

    And this is a part of the HTML code:

    <img alt="logo black" src="../images/logo_black.png" height="60" width="210" />
    

    I've tried with url (relative and absolute) and with path (relative and absolute) but it doesn't work.
    The weird thing is that if I use an old version of TCPDF (5.9.059) everything works fine!

    Any ideas?

     
  • Nicola Asuni

    Nicola Asuni - 2012-12-05

    Please check the paths on the configuration file and manually set them if necessary.

     
  • tampe125

    tampe125 - 2012-12-05

    thanks for the reply, the image path where should point to? to the image folder under tcpdf or somehere else?

     
  • tampe125

    tampe125 - 2012-12-05

    changing the image from .png to .jpg fixes the issues

     

Log in to post a comment.