Kuresh_Surury Member since 2013 4 posts
Areteans Technology Solutions Pvt Ltd
Posted: September 20, 2016
Last activity: July 11, 2017

Embedding Images in pdf using pd4ml

We have a specific requirement to have separate header and footer in document for first Page and rest of the document

So we have used pd4ml inline tags to achieve the same

<pd4ml:page.header pagesToSkip='0' areaHeight='180' scope='1'>
<pega:include name = "DocumentHeaderLogo.Mail"  type="Rule-Obj-Corr" />

<pd4ml:page.footer pagesToSkip='0' areaHeight='150' scope='1'>
 <pega:include name = "FooterTemplate.Mail"  type="Rule-Obj-Corr" />
  <p align="center">Page $[page] </p>



  <pd4ml:page.header pagesToSkip='1' areaHeight='-1'>  
<pd4ml:page.footer pagesToSkip='1' areaHeight='-1'>
<p align="center">Page $[page] </p>

While generating the document we are facing one problem

Images are not getting embedded in generated document if we pass relative path as below

<img src="images/logo.gif">

But if we use below Tag it is embedding the image

<img src="data:image/gif;base64,R0lGODlhkwAYAPcAAA.....DCkFAADs=">

Java code to render the document is as below(we are not using pega wrapper class to invoke pd4ml library in this scenario as we need to set sepcific margin for the document)

String sContent=sHtml;  
org.zefer.pd4ml.PD4ML pd4ml = new org.zefer.pd4ml.PD4ML();  
pd4ml.setPageInsetsMM(new java.awt.Insets(24, 24, 12, 24)); os=new; is=new; ris=new;  
byte[] byteArray=os.toByteArray();  
}catch(Exception e){  
  throw new PRRuntimeException(e.toString());  

I have attached the html and generated pdf when we are using relative path(Decision pdf and generatedstream.txt) as compared to hardcoded image base64 content(test pdf and hardcodedcontenthtml)

Is there a way to resolve the issue and embedded image using relative path instead of hardocding base64 content

***Updated by Moderator: Marissa. Removed user added Ask the Expert group tag. Apologies for confusion, shouldn't have been an end-user option; updated categories***

User Interface
Moderation Team has archived post
Share this page LinkedIn