image in pdf export

(5 posts) (2 voices)

Tags:

  1. Johan, Member

    Hi,
    I have a report using templates. In the template I use an image. In html export the image is shown.
    When I try to export to pdf, the image is gone.
    Any idea how to solve this?
    Johan

  2. myDBR Team, Key Master

    Johan,
    do you use relative or absolute paths in your template images?

    --
    myDBR Team

  3. Johan, Member

    Hi,
    I've tried

    <img style="width: 233px; height: 137px;" src="./user/NieuwCAW_logo.png" height="137" width="233" alt="">

    and
    <img style="width: 233px; height: 137px;" src="user/NieuwCAW_logo.png" height="137" width="233" alt="">

    Johan

  4. myDBR Team, Key Master

    Johan,
    myDBR uses wkhtmltopdf to create the PDF. myDBR first stores the HTML-version of the report into the temp-directory, then runs wkhtmltopdf-against the file. When you use relative paths in templates, what happens is that wkhtmltopdf tries to locate your images from "/tmp/user...." which of course does not exists.

    You can use full URL's "https://yourserver/mydbr/user/NieuwCAW_logo.png" to define the image source.

    Alternatively you can define $mydbr_defaults['export']['wkhtmltopdf']['tmp_directory'] value in user/defaults.php and add symbolic link to mydbr user-directory there. Then you can use relative paths.

    --
    myDBR Team

  5. Johan, Member

    Hi,

    This solved my problem.

    Thanks for your help.

    Johan


Reply

You must log in to post.