I have an ASP.NET web application.I have some PDF files in my server .I want to show those to the user via browser in a new window.how to embed PDF in a browser ? i want the save option to be available for the user to save the PDF .How to go ahead
+1
A:
take a look at
<html>
<head>
<script type="text/javascript" src="/scripts/pdfobject.js"></script>
<script type="text/javascript">
window.onload = function (){
var success = new PDFObject({ url: "/pdf/sample.pdf" }).embed("pdf");
};
</script>
</head>
<body>
<div id="pdf">It appears you don't have Adobe Reader
or PDF support in this web browser.
<a href="/pdf/sample.pdf">Click here to download the PDF</a></div>
</body>
</html>
Josh
2009-06-18 15:14:35
A:
PDF files opened in the browser can be susceptible to XSS, so it is usually best to configure the server so that, when a user requests a PDF, it is opened in it's native application e.g. Adobe Reader.
To configure IIS, open up IIS Manager and:
- Right-click the folder on your site where the PDF files are kept and select 'Properties'
- Go the the HTTP Headers tab
- Click the 'File Types' button under the MIME Map section
- Click 'New Type'
- Add '.pdf' as the extension and 'appliction/octet-stream' as the Content Type
- Click Ok and apply the changes
Now when the user clicks a link to a PDF they should be promted with the 'Open or Save' dialog box that you are after.
Ian Oxley
2009-06-18 15:24:14
A:
I've faced the same problem and a guy from Adobe has an (old) blog post about it link text
It works fine with IE, FF, Chrome with the default Adobe Reader plugin.
Now my only issue left is to display a nice loading thingy while the plugin retrieves the PDF file that is generated on-the-fly.
R4cOON
2009-08-07 09:58:46