Six Stars

Error while opening PDF after generation

Hello,

 

I have a job whose task is to download a list of PDFs in Salesforce by using an attachment ID. The PDFs are being downloaded, however while opening them I'm getting the error:

Capture.PNG

 

While opening the PDF via Notepad++ I'm seeing Base64 String.

Capture4.PNG

 

While decoding the said Base64 string in an online Base64 to text converter, I'm getting the correct version of the PDF to download and it can be opened correctly.

 

Here is the job design:

Capture2.PNG

 

The code in the tJavaRowComponent is:

Capture3.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Error while opening PDF after generation

Hello xdshi,

 

Thank you for your reply.

 

The issue I was encountering was that I was unable to decode a byte array directly to Base64 due to the fact that I was forced to use the library sun.misc.BASE64Decoder as Talend 6.4.1 wasn't compiling my code was I tried to use java.util.Base64

 

To solve it, I had to write the Base64 String to a text file via a tJavaRow, and then read the saved text via another tJavaRow and tFileList and decode it from said Base64 String to get my PDF.

 

Thank you for your involvement.

 

Kind regards.

2 REPLIES
Moderator

Re: Error while opening PDF after generation

Hello,

Have you tried to use a custom component tFileOutputPDF which is written by talend community user and shared on talend exchange portal?

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Error while opening PDF after generation

Hello xdshi,

 

Thank you for your reply.

 

The issue I was encountering was that I was unable to decode a byte array directly to Base64 due to the fact that I was forced to use the library sun.misc.BASE64Decoder as Talend 6.4.1 wasn't compiling my code was I tried to use java.util.Base64

 

To solve it, I had to write the Base64 String to a text file via a tJavaRow, and then read the saved text via another tJavaRow and tFileList and decode it from said Base64 String to get my PDF.

 

Thank you for your involvement.

 

Kind regards.