pvginkel / PdfiumViewer

PDF viewer based on Google's PDFium.
Apache License 2.0
972 stars 418 forks source link

Feature Request - OnLinkClick() event #120

Closed Shmoopy02 closed 7 years ago

Shmoopy02 commented 7 years ago

Would be nice if there was an OnLinkClick() event callback so we can manually handle links to external docs or web pages in apps that use PDFiumViewer. For example, to open the link in another WPF or WinForms tab/window, which AFAIK the demo does not support.

Seems like a simple thing to add for a fairly common use case?

Shmoopy02 commented 7 years ago

Good example of this functionality in DevExpress PDF control:

https://documentation.devexpress.com/#WPF/CustomDocument115891

pvginkel commented 7 years ago

This is already possible. On the PdfRenderer class there is an event LinkClick. If you're using the PdfViewer class, you can access the PdfRenderer class through the Renderer property.

If you handle the click yourself, please make sure to set e.Handled to true to suppress the default handling of the event.