ng2-pdf-viewer
Advanced tools
Changelog
4.1.1
pdfFindController
is now public, that means you can now execute a search on the pdf.
In your component's ts file:
pdf-viewer
,@ViewChild(PdfViewerComponent) private pdfComponent: PdfViewerComponent;
search(stringToSearch: string) {
this.pdfComponent.pdfFindController.executeCommand('find', {
caseSensitive: false, findPrevious: undefined, highlightAll: true, phraseSearch: true, query: stringToSearch
});
}
Changelog
4.0.0
Location of bundles is changed.
Therefor SYSTEMJS
config is now updated to:
var map = {
'ng2-pdf-viewer': 'node_modules/ng2-pdf-viewer/bundles',
'pdfjs-dist': 'node_modules/pdfjs-dist',
};
and then add to packages
var packages = {
'ng2-pdf-viewer': { defaultExtension: 'js' },
'pdfjs-dist': { defaultExtension: 'js' },
};
Changelog
3.0.8
Now both pdfViewer
and pdfLinkService
are public.
You can now scroll to a page from code:
// define view child
@ViewChild(PdfViewerComponent) private pdfComponent: PdfViewerComponent;
// ...
scrollToPage(page: number) {
this.pdfComponent.pdfViewer.scrollPageIntoView({
pageNumber: page
});
}
Changelog
3.0.4
In your code update path
to the worker to be /pdf.worker.js
(<any>window).PDFJS.workerSrc = '/pdf.worker.js';
This should be set before pdf-viewer
component is rendered.