[FIXED] How to add an image to a pdf using Capacitor pdf-generator plugin

Issue

enter image description hereI’m using capacitor pdf-generator plugin to create a pdf. I managed to do so as long as the html code is limited to non image tag, code in which I inject some dynamic data by nesting variable using ${ }.

Now, my aim is to bind the src attribute of an “`img“ tag to a variable so that I can change the logo displayed in the created PDF.

Where I fail: what appears on the PDF is a white space with dashed borders (check picture attached). So I guess that the path must be correct because if not it would show the missing icon (issue I went through before I could format correctly the path).

Anyone who already had that trouble?
see top right corner

Solution

You can convert the images to base64 here https://www.base64-image.de/

then add the codes directly to your image tag

Answered By – shine odigie

Answer Checked By – Marie Seifert (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published