I have an angular2 app, where I want the user to be able to download and open a pdf file in the browser.
Is there an angular2 module or component that I can use?
Try ng2-pdfjs-viewer (https://www.npmjs.com/package/ng2-pdfjs-viewer). IMHO, it proved to be the easiest and most reliable to use so far - while building a pdf intense application. You get a full figure viewer and a lot of additional functionalities - print preview, auto download, open in new tab, zoom, scroll, go to page/named destination, rotate document etc. It works with pdf streams and physical pdf files alike. If you are building around serving pdf through web browser on angular; this package is of great help.
Install it
$ npm install ng2-pdfjs-viewer --save
Add to app module
import { PdfJsViewerModule } from 'ng2-pdfjs-viewer'; // <-- Import PdfJsViewerModule module
@NgModule({
imports: [
PdfJsViewerModule // <-- Add to declarations
],
bootstrap: [AppComponent]
})
export class AppModule { }