I have a Binary Store in a SQL Server Table, In there I have PDF Files (in binary), what I want to do is display the PDF on a webpage in a "DIV". I dont want the user to have to press open so it opens in acrobat reader. I want a small thumbnail which they click and a model windpw opens with the PDF documet displayed as a picture. Does anyone know how to achive this or if there are any components avalible to do this?
+1
A:
To display a PDF within the browser you will need to use the <object>
or <embed>
html tags.
You can use this to point to a PDF file URL to display.
If you PDF is located in a Binary Store somewhere and not linkable from a browser, you will need to build a page (or HttpHandler) to get the binary data and output the file contents so it can be linked via a URL. Have a look at serving files using "Response.Binarywrite".
Mark Redman
2009-10-19 11:53:02
A:
You're looking for rasterization. I've used DynamicPDF's rasterizer with good success, but it's not cheap.
nitzmahone
2009-10-19 12:12:06
If you want to display image version of the pages, yes, you will need to rasterize the pages. However you can use GhostScript on your own servers which is free if you dont want to pay for libraries to do this.
Mark Redman
2009-10-19 12:17:38
You could also use an image printer driver as well for a similar effect, there are a few free ones around.
JonB
2009-10-19 13:45:33
Using image print drivers from a web app is just asking for trouble, though. Very difficult to keep running under load. I've done the direct GS approach before too- as long as you do it by spawning GS processes (not using the API) or setting up a queue to do them one at a time, it works OK, but both start to break down under load. Rasterizing with managed code is not that different (still slow!), but it does scale a little better. You may have to pre-rasterize and cache with whatever approach to ensure scalability.
nitzmahone
2009-10-20 22:41:32