Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i need view preview of PDF file like image preview. in my project user can upload image or PDF file, after upload user can view uploaded file as preview like image box. how is it possible for PDF but for image its working fine. pls help ASAP.
Posted

1 solution

As PDF is not a part of W3 standards, you should not assume that a client has any PDF support at all; it's always purely optional. Even an off-line viewer does not have to be available. That's why the browsers will always suggest an option to save a PDF file.

I don't know what a preview would give the user, so my first suggestion would be: don't provide any preview. I do understand that it might sound frustrating, but I think this is one of the reasonable solution; the user can always quickly preview any file you expose in an anchor.

Another solution would be processing a PDF into HTML using some mapping, and presenting HTML preview. You need to understand that concepts of PDF and HTML are very different, so the way of preview presentation is a matter of some concern. You will find enough open-source products doing the conversion: http://lmgtfy.com/?q=PDF+to+HTML%22C%23%22[^].

Finally, you can make something intermediate. After all, why would anyone need a preview? Because it could be a shortened version of the same document. Only the document author can do it. So, you can suggest the user to supply both complete PDF document and shortened HTML preview. It really makes sense.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900