How to preview files having different formats like .docx, .pdf, .xlsx using its base64 format in Angular app?

Viewed 37

In my Angular application (Angular 9), there is a requirement to preview files in the browser using its base64 data. The files can be of different formats like docx, pdf, xlsx. I have looked into the ngx-doc-viewer. This library can only use the URL to show the files.

Is there any library or methods to achieve this functionality?

2 Answers

You can display PDF using PDF.js, but I don't think there is a good way to display Office docs

Using this simple one line of code, you can display .pdf files, but not .docx.

enter image description here

Related