Events are not triggered when open pdf in external window
See original GitHub issueHey! There is a problem with events, when open pdf in external window. They are not triggered even with ‘viewerId’ attribute. Here is my code:
##HTML
<a *ngIf="document.s3_link" class="document-title" (click)="openDocument(document)">{{ document.description }}</a
>
<ng2-pdfjs-viewer
#externalPdfViewer
viewerId="MyUniqueID"
[externalWindow]="true"
(onDocumentLoad)="highlightSearchTerm()"
></ng2-pdfjs-viewer>
##TypeScript
openDocument(document): void {
this.getDocumentBlob(document.s3_link).subscribe(res => {
this.externalPdfViewer.pdfSrc = res
this.externalPdfViewer.downloadFileName = document.description
this.externalPdfViewer.refresh()
})
}
getDocumentBlob(link): Observable<any> {
let headers = new HttpHeaders()
headers = headers.set("Accept", "application/pdf")
return this.http.get(link, { headers: headers, responseType: "blob" })
}
highlightSearchTerm() {
this.externalPdfViewer.PDFViewerApplication.findController.executeCommand(
"find",
{
caseSensitive: false,
findPrevious: undefined,
highlightAll: true,
phraseSearch: true,
query: this.initQuery,
}
)
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Events are not triggered when open pdf in external window
I have a problem with events, when open pdf in external window. They are not triggered even with 'viewerId' attribute. Here is my...
Read more >Troubleshoot viewing PDF files on the web - Adobe Support
In Reader or Acrobat, right-click the document window, and choose Page Display Preferences. From the list at left, select Internet.
Read more >MS Edge is permanently hijacking PDF files when I am trying ...
Open Microsoft Edge · Click on the three dots (…) from the right top corner. · Select Settings from the drop down and...
Read more >webContents | Electron
Not emitted if the creation of the window is canceled from webContents. ... This event will be emitted after did-start-navigation and always before...
Read more >How to track PDF downloads in Google Analytics
If you are linking to a PDF that opens in a new window (by using ... bar below reads “Tags Fired on this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Please, include this in the documentation/readme.me ! It cost me hours to find this mentioned in a bug report. (actually I almost gave up on the plugin which works great otherwise).
@neuweiler Thanks for the kind words. I have updated the documentation to reflect this. Everywhere events are mentioned - viewerID is mentioned as well.