> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/best-practices/optimizing-lib-folder.md).

# Optimize and reduce lib folder for WebViewer

Optimize & reduce lib folder for WebViewer with a script to delete unnecessary files. Follow step-by-step instructions to customize your WebViewer setup efficiently. The Apryse Web SDK streamlines sec

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

## Optimize via script

A script comes packaged with Webviewer that can be used to delete any files that you will not be using. It is available in the scripts/folder under the @pdftron/webviewer package. You can run this script by (at the root of your WebViewer folder) executing:

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
npm install
npm run optimize
```

{% endcode %}
{% endtab %}
{% endtabs %}

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

{% hint style="info" %}
All questions listed may not be asked.
{% endhint %}

* **Do you want us to back up your files before optimizing?**
  * Answer no to this question if you don't need to back up your files first.
  * Answer yes to this question if you do need to back up your files first.
* **Will you be using WebViewer Server?**
  * Answer yes to this question if you will be using [WebViewer Server](/web/webviewer-server/wv-server-deployment.md).
  * Answer no if you will be using the default [client only mode](/web/what-is-webviewer/deployment-options.md#client-only).
* **Will you be converting all your documents to XOD?**
  * Answer yes to this question if you will be using a [server](/web/custom-server/custom-server-deployment.md) 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 support (docx, pptx, xlsx)?**
  * Answer yes to this question if you want to support opening or converting Microsoft Office files (such as `.docx`, `.pptx`, `xlsx`).
  * Answer no if you do not need Microsoft office support.
* **Do you need client side office support for legacy office files (doc, ppt, xls)?**
  * Answer yes to this question if you want to support opening or converting Microsoft Office legacy files (such as `.doc`, `.ppt`, `xls`).
  * Answer no if you do not need Microsoft office support for legacy files.
* **Do you want to keep both the full and lean versions of PDFNet.js in your build?**
  * Answer yes to keep both versions and allow access to both versions.
  * Answer no if you want the choice to keep one version.
* **Do you need the full PDF API?**
  * We provide a [full API](/web/what-is-webviewer/deployment-options.md#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 want to use the product version of PDFnet.js?**
  * Answer yes to this question if you don't need to access to type checking or console messages and would like a smaller version than the development version.
  * Answer no if you do need access to type checking or console messages and want the larger development version.
* **Do you need to use the content editing feature?**
  * Answer yes to this question if you want to use the content editing feature.
  * Answer no if you do not want to use the content editing feature.
* **Do you need to use the** [**office editing feature**](/web/docx-editor/docx-editor.md)**?**
  * Answer yes to this question if you want to use the office editing feature.
  * Answer no if you do not want to use the office editing feature.
* **Do you need to use the** [**spreadsheet editing feature**](/web/spreadsheet-editor/spreadsheet-editor.md)**?**
  * Answer yes to this question if you want to use the spreadsheet editing feature.
  * Answer no if you do not want to use the spreadsheet editing feature.
* **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](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_resources.htm), 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.
* **Do you want to exclude the use of optimized worker files? If you exclude them make sure that you pass** `enableOptimizedWorkers: false` **to the WebViewer constructor.**
  * Answer no to this question if you want to use optimized workers, which are faster, but may not be supported on some older browsers.

## Why 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:

* **Threaded Wasm** **(Threaded WebAssembly):** Currently only supported by Chrome but more browsers will support it in the future.
* **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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/best-practices/optimizing-lib-folder.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
