I've been looking for the solution to why the image doesn't show up using base64 encoded string in the pdf file. I have java class to generate pdf report with itextpdf and freemarker template. there is logo image that I want to pass to the report. the logo value using base64 encoded string with format as following:
data:image/jpg;base64,base64EncodedString
here is the freemarker template:
<#macro header logo>
<header>
<table width="800">
<tr>
<#if logo??>
<td width="300">
<img src="https://cdn.pixabay.com/photo/2016/03/08/20/03/flag-1244649_960_720.jpg" width="60" height="60" align="left"/>
<img src="${logo}" width="60" height="60" align="left"/>
</td>
</#if>
</tr>
</table>
<br/>
</header>
</#macro>
the first image using url path is working, however the second image using base64 is blank. the image is appear when I run it through jsfiddle or using html file https://jsfiddle.net/riskiana/jvug1tzL/3/
please somebody help me.
thanks
iText html2pdf currently doesn't support base 64 encoded resources.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.