0

Hey guys I am new at Front End Development. I want to display my pdf file from byte array like:

<embed id="preview_pdf" src=' +myitem + "?#zoom=85&scrollbar=0&toolbar=0&navpanes=0" +  ' frameborder="0" oncontextmenu="return false" onselectstart="return false" ondragstart="return false" allowfullscreen >' + '</embed>');

how it is possible for me ?

Himelu5
  • 15
  • 3
  • Does this answer your question? [Display PDF within web browser](https://stackoverflow.com/questions/4853898/display-pdf-within-web-browser) – Stomf Sep 03 '21 at 07:58
  • Sadly no since im getting my pdf file as byte array and want to display that pdf file from database – Himelu5 Sep 03 '21 at 08:01

1 Answers1

2

The Adobe Embed API can be used to display PDF files in modern browsers and can accept a Promise that resolves to an array buffer as input. The important part of the code might look like this...

adobeDCView.previewFile({
    content: { promise: Promise.resolve(buffer) }
    metaData: { fileName: :"myFile.pdf" }
}); 

It's free.

joelgeraci
  • 4,606
  • 1
  • 12
  • 19