Recreate a PDF from an Online PDF

Four Stars

Recreate a PDF from an Online PDF

Hello,
I'm starting with Talend and I'm not sure if what I want to do is possible or not Smiley Happy.

I want to recover a PDF file from a Rest API (I'm using an OpenBee API) and send it as an attachment in an email.

For now I manage to recover the url of my file but when I make a GET request on this URL, it sends me the PDF code of my file. After that, I can not properly reform it because the encoding is UTF-8 and converting back to ANSI does not change anything.

How can I do to resolv this problem ? 

Thank you in advance, 

Regards,

Jb



Accepted Solutions
Sixteen Stars

Re: Recreate a PDF from an Online PDF

Actually, I've rethought this. Use the tFileFetch component. That should handle everything for you.


All Replies
Sixteen Stars

Re: Recreate a PDF from an Online PDF

If you simply click on the URL (or use it in a web browser) does it return the PDF as expected? If so, I suspect you may be receiving a text representation of the byte code back. If so, try connecting it to a tFileOutputRaw component and that might solve this for you.

Four Stars

Re: Recreate a PDF from an Online PDF

Hi,

Thanks for replying. I think you're right because the URL returns the PDF as expected. So it gives me a text representation of the byte code I think Smiley Happy

The problem is from the encoding, I think, because my tRestClient is getting the text representation of the byte code in UTF-8 and there's some characters that it does not understand. Encoding it back in ANSI does not change anything either...
I already tried to connect a tFileOuputRaw after my tRestClient but it only gives me a blank page Smiley Sad

Regards, 

Jb

Sixteen Stars

Re: Recreate a PDF from an Online PDF

Actually, I've rethought this. Use the tFileFetch component. That should handle everything for you.

Four Stars

Re: Recreate a PDF from an Online PDF

That is what I was looking for. Thank you very much for your help. I just have a last problem with authentication with my http address ...

Regards, 

Jb