I'm using PDF.Js to embed PDF file for preview, and I removed the script of download and open files from the viewer.js
, but when I test the page and PDF file try to show, the Internet Download Manager download it and abort the preview .. after search I found that using object
instead of iframe
may solve the problem, but it didn't work the pdf viewer appeared white, what can I do to prevent auto download ? or using another way (Plugin) to show PDF file content.
<iframe class="pdf" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" frameborder="no" width="'.$width.'" height="'.$height.'" src="'.$baseurl.'/assets/pdf/web/viewer.html?file='.urlencode($pdf_url).'" data-src="'.$pdf_url.'"> '.$pdf_url.' </iframe>
You can't disable the Download button in your PDF files, and you sure can't prevent the user from choosing Print... in the right-click menu for the entire screen. What you can do is password protect your PDF in Adobe Acrobat. Aside from password protection, their Protect tool also allows you to disable printing.
You need to open "Options->General" IDM dialog and press "Edit" near "Customize IDM download panels in browsers". Then enable "Don't start downloading from web-players automatically" option (arrow 1 on the image) and press "OK" (arrow 2 on the image).
Scroll to the Privacy & Security settings and click 'Site Settings'. What is this? On the Site Settings page, click 'PDF documents'. On the page that follows, turn on the 'Download PDF files instead of automatically opening them in Chrome' option.
This is not something related to developing issue , this is something related to user specific environement.
The Issue :
Using IDM ,any URL that ends with a media extension (e.g *.JPG , *.PNG , *.MP4 , *.WMV , *.PDF ..etc ) will be downloaded automatically , However on the other hand if the user doesnt have IDM installed , the file will be viewed immediately in browser window.
Possible Solutions :
Final Note:
As a developer you shouldnt handle each user specific environment , we suppose that when user installs a specific app to handle generic files , then it is his/her role to handle that application , and not the developer role , cause if you follow this algorithm you jump inside infinite loop handling different users specific setup.
Just remove .pdf
Extension from the main file. IDM cannot detect what kind of file it is. but the browser will handle its native way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With