image in pdf export

(10 posts) (3 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

  6. Fadi Nofal, Member

    Dear myDBR Team,

    I Faced the same issue with Templates Images and I Solve it based on your previous replay, Still have issue that when exporting Report to PDF the Template Custom Fonts Not Works.

    Please help me ...

  7. myDBR Team, Key Master

    Fadi,
    how does your custom font definition look like in the CSS?

    --
    myDBR Team

  8. Fadi Nofal, Member

    in userstyle.css

    @font-face {
    font-family: 'Gotham Medium';
    src: url('http://10.200.4.99/API/user/fonts/Gotham-Medium.otf') format('opentype');
    }

    @font-face {
    font-family: 'GE SS Two Light';
    src: url('http://10.200.4.99/API/user/fonts/GE_SS_Two_Light.otf') format('opentype');
    }

  9. myDBR Team, Key Master

    There seems to me an issue with wkhtmltopdf. We'll take a look at it.

    --
    myDBR Team

  10. myDBR Team, Key Master

    Fadi,
    the custom font issue with wkhtmltopdf is now fixed. wkhtmltopdf had problems with some ES& JS code which caused problems with the font.

    No need to use full URL in the font url as it is relartive to the CSS file being used. You can use:

    @font-face {
    font-family: 'Gotham Medium';
    src: url('fonts/Gotham-Medium.otf') format('opentype');
    }

    --
    myDBR Team


Reply

You must log in to post.