1

I am subscribing to a service HTTP get call hitting which i am downloading a pdf document.

How can i use that document, saving in any variable and trigger HTTP POST call so that i can send that document to server on any specific Action ?

Another doubt - How to get that document/document response and store it any variable ? After hitting that HTTP GET call simply file is getting downloaded. How to access that document in code ?

Server Language: Java

FrontEnd: Angular

1 Answers1

1

Convert your pdf file into BSON(Binary JSON)/ base64 type, Simply store that converted data in string variable, And pass that data into body of your HTTP POST.

Dhaval Darji
  • 513
  • 5
  • 19
  • This is not a good way to upload a large PDF. It takes time to convert to BSON and Sometimes API might timeout due to traffic. – Chamikara Samarasekara Jan 29 '21 at 05:13
  • can you please let me know how to do this ? I am unable to get document response OR document data. Just hitting that get Call file is getting download. –  Jan 31 '21 at 15:02
  • did you try with responseType: 'blob' ? you can pass it to get call as second parameter . http.get(url, { responseType: 'blob', }) . – Lokesh Daiya Feb 03 '21 at 14:37