Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

How do I capture a mouse click on a link and show a PDF File

Post Reply
User avatar
salvadordf
Posts: 4040
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How do I capture a mouse click on a link and show a PDF File

Post by salvadordf »

Hi,
stwizard wrote: Tue Aug 13, 2019 3:08 pm 1) I need to know where the best event would be to detect the mouse click on the link so I can download the document.
TChromium.OnBeforeDownload will be triggered before the download starts. You can let CEF download the file or cancel it in the TChromium.OnDownloadUpdated event and start your own download using third party components or a URLRequest.

Read this for more information about that event :
https://magpcss.org/ceforum/apidocs3/pr ... llback%3E)
stwizard wrote: Tue Aug 13, 2019 3:08 pm 2) I need to be sure that the link is a PDF content and if so show it in the viewer
You can use the "downloadItem" parameter in TChromium.OnBeforeDownload and read the "downloadItem.MimeType" property.
Consider registering your application as a PDF viewer in Windows and let Windows open your application when the user clicks on a PDF file.
Post Reply