danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.92k stars 358 forks source link

Embed images to PDF without using HTML #909

Open anjanesh opened 1 year ago

anjanesh commented 1 year ago

How do I add images to the PDF without using a link or base64 string ?

byte[] bytArr = oHelper.GetImageFromFirebase(imgUrl, false);

The reason why link is not available is because its not globally available - only on localhost.

No base64 string because the size becomes huge since there are about 100 images.

So I am looking for a way to add images in the middle of the HTML page like we can do in mPDF - $mpdf->Image();

schulm commented 1 year ago

Hi @anjanesh, I think this can be handled with a custom uri resolver.

https://github.com/danfickle/openhtmltopdf/wiki/Integration-Guide#uri-resolver