Question

6
Replies
2729
Views
sandeep.kar07 Member since 2014 8 posts
Cognizant Technology Solutions Private Limited
Posted: 8 months ago
Last activity: 6 months 2 weeks ago
Solved

Convert Base64 Stream to PDF

Hi All,

I have a requirement where i need to convert jpg, jpeg and tiff files to pdf format. I have the Base64 encoded stream of the files in clipboard. How do i need to convert this into PDF file ?

I have tried using this code in a Java Step before calling Code-Pega-PDF.View Activity. 

String s = tools.getParamValue("Markup").toString();        //markup is the base64 encoded string

byte[] byteArray = new com.pega.pegarules.pub.util.Base64Util().decodeToByteArray(s);

tools.putParamValue("PDFDocument",byteArray);

I am able to download the PDF file post these steps but I am unable to open the PDF file. Its saying that its damaged (file is not correctly decoded)

Please let me know way to convert Base64 Stream into PDF file.

***Moderator Edit-Vidyaranjan: Updated Platform Capability***  

Reporting
Share this page LinkedIn