html
<ng2-pdfjs-viewer pdfSrc="gre_research_validity_data.pdf" viewerId="MyUniqueID" (onBeforePrint)="testBeforePrint()" (onAfterPrint)="testAfterPrint()" (onPagesLoaded)="testPagesLoaded($event)">
</ng2-pdfjs-viewer>
typescript
For events to work properly, you should set viewerId. This helps event routing to understand which component the event is to be sent to, even if there are more than one ng2-pdfjs-viewer component in the page.
Please click on the print button/icon to emit print related events.
public testBeforePrint() {
console.log("testBeforePrint() successfully called");
}
public testAfterPrint() {
console.log("testAfterPrint() successfully called");
}
public testPagesLoaded(count: number) {
console.log("testPagesLoaded() successfully called. Total pages # : " + count);
}