1

I am working on a project where I am generating a PDF on the server-side and I require to receive that PDF with a message from the API response. I tried a couple of methods but did not succeed.

Here is what I am receiving from API.

data:
contentType: "application/pdf"
entityTag: null
fileContents: "JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7/AFAARABGA.....long string
fileDownloadName: "20220525163341.pdf"
lastModified: null
[[Prototype]]: Object
status: {message: 'File Has been genrated succesfully', status: 200, messageCode: 0}
[[Prototype]]: Object

I want to know how I can download this generated file as a PDF in Angular?

Aluan Haddad
  • 29,886
  • 8
  • 72
  • 84
  • If you didn't catch the correct answer above, the `fileContents` string there is a base64-encoded PDF file. If you decode that, you'll see it starts "%PDF-1.4". – Tim Roberts May 26 '22 at 03:51

0 Answers0