PDF.js is a general-purpose, web-standards-based JavaScript library for parsing and rendering PDF files. The most important benefit in my opinion is that you can display PDF files to your customers without having to worry whether they have a local PDF viewer installed on their machine.
PDF.js is HTML5 based and works best on Firefox, Safari, and Opera. IE 8 and previous versions are not supported. For more information see the following link:
PDF.js Browser Support.
So what should you do to integrate it in your project? Here is a simple step-by-step guide:
That’s all.
There is a sample project (runnable website) attached to this blog post. Click here for download [UPDATED 12.Feb.2015]. The setup involves three Telerik controls - ListView, Rotator, and Window. The first two are bound to a simple datasource and display thumbnails of the PDF files that will open in the Window control on click.
[12.Feb.2015] I have updated the demo with the following changes:
I know this is a hot topic so I hope the blog post is useful for you. Should you have any questions or suggestions let me know in the comments section below.
Additional resources:
PDF.js @ Mozilla Labs
RadRotator documentation
RadListView documentation
RadWindow documentation
Daniel Peichev is Software Developer at one of Telerik's ASP.NET AJAX teams, where he primarily works on exporting functionality for RadGrid and RadTreeList. Daniel is interested in ASP.NET, Javascript, CSS and the cutting edge Microsoft technologies and products.