Question

2
Replies
2719
Views
Mahesh_Sawant Member since 2013 12 posts
Capgemini
Posted: 3 years ago
Last activity: 3 years 8 months ago
Closed

PDF Generation from PD4ML

We are generating PDF documents from the correspondence templates, for generating it we are using PD4ML library instead of Pega OOTB HTMLtoPDF to achieve the customer requirements. Basically we are mentioning "10pt" as font size in the correspondence template but the generated PDF is showing as "11pt" or "10.5pt" font size.

PD4ML Code snapshot

try{

String sContent=sHtml;

org.zefer.pd4ml.PD4ML pd4ml = new org.zefer.pd4ml.PD4ML();

//pd4ml.resetAddedStyles();
pd4ml.setPageInsetsMM(new java.awt.Insets(10, 21, 0, 16));
pd4ml.enableImgSplit(false);
java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
java.io.InputStream is=new java.io.ByteArrayInputStream(sContent.getBytes());
java.io.InputStreamReader ris=new java.io.InputStreamReader(is);
pd4ml.setCookie("JSESSIONID",JSESSIONID);
pd4ml.setCookie("Pega-RULES",PEGARULES);
pd4ml.useTTF(FontsProp,false);
java.net.URL base=new java.net.URL(BASEURL);
pd4ml.enableDebugInfo() ;
pd4ml.render(ris,os,base);

byte[] byteArray=os.toByteArray();

// Action == Preview
if (Action.equalsIgnoreCase("Preview")){
String sPDF=Base64Util.encodeToString(byteArray);
ClipboardPage workpage = tools.findPage("pyWorkPage");
workpage.putString("PDFDocument",sPDF);
}

else {
tools.putParamValue("PDFDocument",byteArray);
}

}catch(Exception e){

throw new PRRuntimeException(e.toString());
}

***Moderator Edit: Vidyaranjan | Updated Categories, tagged SRExists***

Case Management SR Exists
Moderation Team has archived post
Share this page LinkedIn