Control file downloads in the ASP.NET Core PDF Viewer
Use the downloadStart event to intercept the start of a download and optionally cancel it. In the event handler, set args.cancel = true to prevent the download.
By default, args.cancel is false, so the download proceeds unless explicitly canceled.
Flexibility
Leverage the downloadStart event to apply custom rules for allowing or preventing downloads based on application needs.
<div style="width:100%;height:600px">
<ejs-pdfviewer id="pdfviewer"
style="height:600px"
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
downloadStart="downloadStart">
</ejs-pdfviewer>
</div>
<script>
function downloadStart(args) {
// Your custom logic here
args.cancel = true; // Prevent download action
};
</script><div style="width:100%;height:600px">
<ejs-pdfviewer id="pdfviewer"
style="height:600px"
serviceUrl='/Index'
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
downloadStart="downloadStart">
</ejs-pdfviewer>
</div>
<script>
function downloadStart(args) {
// Your custom logic here
args.cancel = true; // Prevent download action
};
</script>