Hello,
Can anyone suggest me which is the best way of displaying a PDF document in an aspx page. I want users to use zoom functionality while viewing the pdf document.
Thanks in advance
Hello,
Can anyone suggest me which is the best way of displaying a PDF document in an aspx page. I want users to use zoom functionality while viewing the pdf document.
Thanks in advance
If you have the PDF in memory use one of the Stream objects to break it down to a byte array (possibly using the .ToArray() function of the MemoryStream class). In this example below the byte array is called data:
Response.ContentType = "Application/pdf";
Response.OutputStream.Write(data, 0, data.Length);
Edit: This approach works well if all you want to do is serve up a PDF. After reading some of the comments I realized the question was more focused on showing a PDF inside a section of a webpage. Another alternative I have used is an embed tag that references a codefile function. In this case, if you have the PDF on a disk drive you can use
<embed id="Embed1" src='<%# pdfLocation() %>' runat="server" name="pdfLoad"></embed>
Where the function pdfLocation returns a string representation of the location of the PDF file.
It looks like a Flash-based solution would work best for you in this situation, such as Adobe FlashPaper. There is no dependency on the browser having a PDF plug-in that displays the document in the browser, such as Adobe Reader or Foxit Reader. It supports zooming, searching, printing, full-screen mode, and text selection, and you don't have to rely on a third-party hosted solution like Scribd.