Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
EGuarato1648206044
Contributor III
Contributor III

From tRestClient to PDF

Hi there,

I'm retreiving a PDF file from an API request ("POST").

I'm getting trouble in storing the PDF File.

I'm trying using tJavaRow but I generated i blank file.

Is there others tool or some java code that should help me?

Among all codes, the last one I tried

   String inputString = input_row.PDFDaConvertire;

   byte[] byteArrray = inputString.getBytes("UTF-8"); //I tried with also ASCII and ISO

 8859-1 

   Files.write(Paths.get("out.pdf), byteArrray);

Labels (4)
1 Solution

Accepted Solutions
EGuarato1648206044
Contributor III
Contributor III
Author

Solved , changing approach, using tFileFetch.

 

https://community.talend.com/s/question/0D53p00007vCqFGCA0/resolved-is-possible-to-download-a-file-through-trestresponse?language=en_US

View solution in original post

3 Replies
Anonymous
Not applicable

Hi

I am not a specialist in Java, make sure you have the expected response string from API, we usually use tLogRow to print the response on console for debugging. To write a PDF, this page recommended to use PDF libraries like iText or Apache FOP or the custom component shared on Talend Exchange, such as tOutputPDF2

 

 

Regards

Shong

EGuarato1648206044
Contributor III
Contributor III
Author

Not working. The tRestClient that retreive the PDF with a POST API call, pass the file in String to the next component. Using a string to pass the file means losing data to rebuild it and the tOutputPDF just create a PDF of the string.

 

I'm trying to use tHttpRequest but i got the error 411

EGuarato1648206044
Contributor III
Contributor III
Author

Solved , changing approach, using tFileFetch.

 

https://community.talend.com/s/question/0D53p00007vCqFGCA0/resolved-is-possible-to-download-a-file-through-trestresponse?language=en_US