Skip to content Skip to sidebar Skip to footer

How To Prevent Download When The Pdf Load To Iframe?

When the iframe loading with pdf automatically download the pdf file. How can i prevent this. $(function () { $('#dialog').dialog({ autoOpen: false, modal: true, resi

Solution 1:

Use some PDF viewer to avoid it downloadable. Google Viewer for instance.

Example:http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true

Using PHP read the details here

This will help you as well in reading file using PHP: http://www.setasign.com/products/fpdi/about/

Solution 2:

You can't make sure: it ultimately depends upon the user's software. Often, browsers will open PDFs inline, but this is only if the user has installed a PDF viewer and associated it with the PDF MIME-type, allowing the browser to embed that application and open the file with it.

If the user does not have PDF viewer software associated with the PDF MIME-type and embedable with their browser, the browser will not know what to do with the PDF and will thus prompt the user to download it. If you're certain the browser you're testing on can read PDF files, you may want to make sure your server is serving the PDF file with the correct MIME-type: application/pdf.

If you want to make sure the user views the contents of the PDF on your site, you may want to use a Javascript or Flash library (although in the case of Flash, you are expecting the user to have the Flash plugin installed instead) to parse the PDF and render it inline. The Mozilla PDF.js project may be useful if you go down this route; otherwise you may want to try FlexPaper for Flash.

Post a Comment for "How To Prevent Download When The Pdf Load To Iframe?"