How Accusoft PDF Viewer Improves Upon PDF.js
The ability to view PDF files has become an essential feature for web-based applications. While dedicated desktop readers are still common, the average user justifiably expects to be able to view documents without switching between applications. Thanks to browser-based PDF libraries like PDF.js, developers can both integrate the viewing features they need and build the next generation of PDF viewing integrations.
What Is PDF.js?
Unfortunately, this created several security risks. External plug-ins can contain malicious code or gather data that could endanger privacy. Downloading PDFs for local viewing is also potentially hazardous because it means the file must be removed from a secure application environment.
In addition to being integrated into Firefox, the software was also made available as open-source code. This made it possible for independent developers to expand upon the core capabilities of PDF.js in the years since its release.
Should You Build or Buy a PDF.js Viewer?
The open-source availability of the PDF.js library makes it an attractive solution for software teams looking to add native viewing functionality to their applications. As with many open-source frameworks, however, developers may quickly run up against a few complications when building out a viewing solution from scratch.
Out-of-the-box, PDF.js consists of three basic layers:
- Display Layer: This interface handles the actual rendering of the PDF into a <canvas> element.
- Viewer Layer: The primary viewing interface that allows users to view and interact with the document.
While the core and display layers can handle most documents, PDF.js doesn’t support the full PDF specification and sometimes struggles with rendering lengthy, complex, or image-heavy files. Overall performance is often on the slow side, and the way text is rendered makes text search somewhat unreliable.
More importantly, PDF.js lacks out-of-the-box mobile support. The included viewer doesn’t provide essential mobile UI features like pinch-to-zoom. It also doesn’t respond dynamically to mobile screens to ensure that menus and tools remain usable on all devices.
Any developer looking to add PDF viewing capabilities to their web applications using PDF.js will need to solve these core issues. While features like responsive, mobile-friendly viewing may have been less important when PDF.js first released in 2011, they are considered essential by most users today. Unfortunately, building out these capabilities takes time and resources, which is something that few development teams have in abundance.
Integrating a ready-made viewer that combines the solid foundation of PDF.js with the innovative features users expect allows developers to quickly meet their project needs without pulling attention away from key aspects of their application.
PDF.js and Accusoft PDF Viewer
When the time came to develop a lightweight PDF viewer that could be deployed quickly as a 100% client-side solution, the Accusoft engineering team elected to use PDF.js as a starting point. With a decade of open-source development already behind it, the PDF.js library offered extensive resources that provided us with a great deal of flexibility as we designed a new viewing interface and worked to improve performance in terms of speed and file support.
Existing PDF.js viewers tend to struggle with large and complex documents. They also don’t offer good text search support. We drew upon years of experience with image processing to enhance rendering quality, which included adding support for high DPI screen displays. These improvements allow the viewer to render text and vector based elements more sharply. We also implemented a number of enhancements to boost search result speed.
Responsive Mobile Support
Out-of-the-box mobile functionality is no longer a “nice-to-have” feature for a PDF viewer. That’s why we focused on building a user interface that not only provides key touch controls like pinch-to-zoom and swipe gestures, but also seamlessly adapts to various screen sizes. Since PDF.js doesn’t offer responsive viewing capabilities, we worked hard to design a viewer that would offer the same level of flexibility regardless of the device being used.
The open-source version of PDF.js comes with a few significant limitations in terms of functionality. In addition to the complete lack of responsive mobile viewing support, PDF.js does not provide annotation or eSignature capabilities. It’s also extremely limited in terms of viewer customization. That’s why the Professional Version of Accusoft PDF Viewer incorporates these features right out-of-the-box so developers can quickly implement them into applications without having to build them from scratch.
Experience the Evolution of PDF.js
While PDF.js has long served as an adequate open-source PDF viewing solution for web applications, today’s average user simply requires more functionality than PDF.js can provide on its own. For developers who lack the time, resources, or expertise necessary to build those additional features, PDF.js-based integrations like Accusoft PDF Viewer can provide everything they need to add powerful PDF capabilities to their software solutions.