[handlebars / phantomjs] Unable to render image in PDF



  • Hello,

    I'm trying to insert image in jsreport (PDF) with the following header template :

    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    </head>
    <body>
    <style>
    {#asset CallRatio header.css @encoding=utf8}
    </style>
    <div class="header-box">
    <table cellpadding="0" cellspacing="0" class="header">
    <tr class="logos">
    <td><img src="{#asset General Thelis.png @encoding=dataURI}" /></td>
    <td>{{Report.Name}}</td>
    <td><img src="{#asset General Kiwix.png @encoding=dataURI}" /></td>
    </tr>
    </table>
    </div>
    </body>
    </html>

    But the images aren't displayed in the PDF, no error in logs, so I'm a bit lost here.
    The images appear in the generated html header (%TEMP%/jsreport) but when phantomjs generate the pdf, no image are visible.

    Any idea how to debug/solve this?

    Thanks,

    Stéphane


  • administrators

    hi! i think the problem (phantom bug) and the workaround is described here -> https://jsreport.net/learn/phantom-pdf#images-in-header-and-footer

    let me know if it was helpful


  • administrators

    here is example of the information described in previous link https://playground.jsreport.net/studio/workspace/SJQA3b1Xb/3



  • Hi,

    Thanks, I missed this issue article and fix, I'll check it out.

    Thanks again for your quick answer. :-)

    Stéphane



  • Well, this is rather strange.

    Here is my header :

    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    </head>
    <body>
    <style>
    {#asset CallRatio header.css @encoding=utf8}
    </style>
    <div class="header-box">
    <table cellpadding="0" cellspacing="0" class="header">
    <tr class="logos">
    <td><img src="../jsreport/data/assets/General%20Kiwix.png/content.png" /></td>
    <td>{{Report.Name}}</td>
    <td><img src="{#asset General Kiwix.png @encoding=dataURI}" /></td>
    </tr>
    </table>
    </div>
    </body>
    </html>

    The first image render correctly in the pdf, the second one doesn't appear. I guess it's a path issue but I can't figure how to fix it. Any lead? (config / assets / publicAccessEnabled is at true and the files exists, of course)

    Thanks,

    Stéphane


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.