Page 1 of 1

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

Posted: Tue Aug 13, 2019 5:50 pm
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.