0

I get following content from my backend (Spring):

contentType: application/pdf

content: JVBERi0xLjUKJeLjz9MKNCAwIG9iago8PC9Db2xvclNwYWNlWy9JbmRleGVkL0RldmljZVJHQiAxNii1yoGQsELa5cB0nRP2+O/s8t/H16B+oyPj69CjvmLR3rCHqjKZt1KsxHK+0ZBrlgP///8pXS9NYXNrIFsxNiAxNl0vU3VidHlwZS9JbWFnZS9IZWlnaHQgMjE1L0ZpbHRlci9GbGF0ZURlY29kZS9...

How can I display that in my template (should be a pdf document). Already tried everything recommended here on SO - but always get a broken image.

tried e.g.:

<img [src]="(imageString$ | async) | sanitize" style="width:600px;height:600px">

<img [src] = "'data:image/png;base64,' +imagePath" alt="" style="width:600px;height:600px">

but nothing works

Andi
  • 1
  • 1
  • 1
  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Apr 21 '22 at 04:42
  • Can you please provide the `component.html` code where you are trying to display this pdf? Right now it is unclear what you are trying to do with this pdf. Open in new window, new tab, iframe, other???? – Zze Apr 21 '22 at 05:54
  • 1
    `imagePath` does not sound like base64 content – Antoniossss Apr 21 '22 at 06:48
  • There's some solutions for display of PDFs [here](https://stackoverflow.com/questions/17784037/how-to-display-pdf-file-in-html). – Hopey One Apr 21 '22 at 23:47

1 Answers1

-1

You are need 3rd party library or component to display PDF

alezhu
  • 475
  • 3
  • 6