Question

1
Replies
49
Views
Guilherme Valino (GuilhermeV7620)
CI&T
Lead System Architect
CI&T
BR
GuilhermeV7620 Member since 2016 20 posts
CI&T
Posted: January 22, 2021
Last activity: January 24, 2021
Posted: 22 Jan 2021 13:22 EST
Last activity: 24 Jan 2021 18:16 EST

Convert Base 64 to PDF - Problems

I'm using version 8.5 and I have a requirement where I get the return of a service that responds to a file in base64 and then I have to convert it into a byte, so that it is possible to download the PDF or even attach it to the case.

 

I am using the function below, but the pdf file is being generated corrupted. The same function in version 7.2.2 works very well.

Can someone help me and indicate what should be done?

String s = tools.getParamValue ("contentStream"). ToString (); // markup is the base64 encoded string byte [] byteArray = new com.pega.pegarules.pub.util.Base64Util (). decodeToByteArray (s); tools.putParamValue ("PDFDocument", byteArray);

 

***Edited by Moderator Marissa to update Content Type from Discussion to Question***
Pega Platform 8.5.1 Case Management Low-Code App Development Insurance Lead System Architect