How can I reduce the WebViewer package size?

58 views
Skip to first unread message

Euan Carmichael

unread,
Aug 9, 2018, 3:13:10 PM8/9/18
to PDFTron WebViewer
Q: How can I reduce the size of the WebViewer package that I'm using?

A: Firstly, it's important to understand that when a user connects to your website, only the minimal set of required files for WebViewer will be pulled down on-demand by the browser.  The WebViewer package contains a number of browser specific files designed to give the best performance for those specific browsers.  As a result, only a subset of these will every be served to the client.

If you are redistributing the package directly to the client, for example if you're developing a offline mobile web app, and you need to reduce the package size then there are a number of options available.  These depend on the functionality that you require and the browsers being targeted.
  • PDFNetJS Full vs Lean:
    The WebViewer package includes two variants of the PDFNetJS library.  PDFNetJS Full is a complete browser side PDF SDK, allowing for viewing, parsing and direct editing of PDF documents all within the browser.  PDFNetJS Lean allows for a subset of this functionality to be performed, specially geared towards the viewing of PDF documents.  Depending on the functionality you require, only one of these variants of the library needs to be distributed.  The files can be located in WebViewer\lib\html5\pdf.
  • Office support:
    If your application does not require support for viewing MS Office documents then this section of the library can be removed, you can find these files in WebViewer\lib\html5\office.
  • XOD WebViewer:
    If you require a very lightweight package to redistribute and are able to convert your documents to XOD format before serving to the client, WebViewer is able to view these documents without requiring PDFNetJS which can then be removed from your package.  This option would require a custom server implementation which you can read more on in our user-guide: https://www.pdftron.com/documentation/web/guides/custom-server
  • Targeting specific browsers:
    If you are targeting specific browsers then it's possible to remove some of the files within the PDFNetJS library which are used by other browsers.  Please contact sup...@pdftron.com for guidance on your specific use-case.
Reply all
Reply to author
Forward
0 new messages