Some test text!

platform
search

Optimizing the lib folder

Contents

Optimize via script
Why does the folder size still seem large?

Webviewer comes bundled with the files required for all use cases. In many situations, all these files are not needed.

linkOptimize via script

A script comes packaged with Webviewer that can be used to delete any files that you will not be using. You can run this script by (at the root of your WebViewer folder) executing:

npm run optimize

The script will ask you a series of questions, and delete files based on your answers:

Will you be using the new UI?

Answer yes to this question if you want to use the new ui. A preview of this UI can be found here.

Answer no if you want to use the legacy ui.

Will you be using WebViewer Server?

Answer yes to this question if you will be using WebViewer Server.

Answer no if you will be using the default client only mode.

Will you be converting all your documents to XOD?

Answer yes to this question if you will be using a server to convert all your documents to the XOD format before viewing.

Answer no if you will be opening any format other than XOD.

Do you need client side office viewing support?

Answer yes to this question if you want to support opening Microsoft Office files (such as .docx, .ppt).

Answer no if you do not need Microsoft office support.

Do you need the full PDF API?

We provide a full API that can process documents outside of the viewer.

Answer yes to this question if you need to access to the full API.

In most cases, you do not need the full API and can answer no to this question.

Do you need to deploy to Salesforce?

To be able to upload WebViewer source code to Salesforce as static resource files of 5 MB in size, we need to optimize and split up WebViewer code into separate chunks.

Answer yes to this question if you are planning to deploy to Salesforce platform and need to optimize WebViewer.

Answer no if you are not deploying to Salesforce platform.

linkWhy does the folder size still seem large?

Note that the lib/core/pdf folder contains multiple versions of the same PDF SDK logic that are optimized for different browsers. The versions are:

PNaCl: For Chrome desktop. This is currently the fastest version.
Wasm: WebAssembly version for Edge, FireFox, iOS 11+ and Android Chrome 59+
asm.js: For IE11, iOS10-, Android Chrome 58-. This is the slowest version.

Only 1 of the 3 is actually loaded at runtime, so while your server would have all the files, each user would only download a subset of them.

Contents

Optimize via script
Why does the folder size still seem large?