Question
Thryve Digital Health LLP
IN
Last activity: 20 May 2022 11:49 EDT
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***
-
Likes (2)
Guilherme Valino Ashwani Mishra -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 10 Apr 2020 2:23 EDT
Thryve Digital Health LLP
IN
Hi All, I have solved this issue. I am able to convert Base64 Data to PDF file and also attach it to the work object.
Please find the detailed steps in the attached file.
Updated: 14 Jun 2021 7:38 EDT
Pegasystems Inc.
IN
Please find the below URL to see if this solves the issue.
Thryve Digital Health LLP
IN
I have tried the steps mentioned in the link. But post that, i am unable to open the PDF. It is saying that PDF is damaged (file is not correctly decoded)
Pegasystems Inc.
CA
If possible, can you share the base64 string as a text attachment here?
Pegasystems Inc.
IN
Hi,
Create a section rule with following lines.
add your base64 string to some property that you will refer in section rule as mentioned above.
Use HTMLToPDF activity to convert this section rule into a pdf.
-
Justin Galui Adithya Acharya
Ernst & Young
SV
Hello,
I am working on something similar as well, currently I am able to just decode Base64 text to text but I need to decode Base64 to image, have you found a solution that can be shared?
Accepted Solution
Updated: 10 Apr 2020 2:23 EDT
Thryve Digital Health LLP
IN
Hi All, I have solved this issue. I am able to convert Base64 Data to PDF file and also attach it to the work object.
Please find the detailed steps in the attached file.
-
Madan Kumar Prakash Murthy Suresh Kumar Nerella Preethi Ganesh Naveen Kumar Boda Amit Sachan and 1 More
Carelon Global Solutions
IN
Hi sandeep
You have called an activity attach files from an existing activity. That activity contains more than 8 lines. Can you attach the image of ATTACH FILES activity? And when I try to run the activity it shows an error in tracer that instance not found. What is the fix for this?
Pegasystems Inc.
US
HI @AvinashV2345,
This is an inactive and solved thread. Please write a standalone Question if you are still having this question.
Thank you!
Bank Of America
US
Hi Sandeep,
Could you please share activity steps with Java code how you managed to convert Base64 to PDF? I am working on same requirement but not working.
Bank Of America
US
Pegasystems Inc.
US
Hi @SridharP9507,
This is an older post and Sandeep is no longer active in the Support Center. I see that you created a Question of your own Convert Base 64 to PDF.
The Moderation team will see if we can find a SME that may assist you on your own Question.