I found this guide in the documentation.
But when I try to run the command “npm run optimize”
It shows me an error saying that the command does not exist.
Do they know exactly where the command should be launched?
I am launching it at the root of the webviewer library.
Any help is welcome
Thanks for bringing this up.
Are you using WebViewer through a npm package? It looks like we only included the optimize script in the manual download package, not the npm one.
A pull request that will fix this issue is under review, and the fix will be included in the next version.
The attached is the script that you can run using node to remove some unnecessary files in the lib folder depending on your usage. Note that you may need to change some paths in the script to make it work for your folder strucutre.
Another option would be downloading the package from https://www.pdftron.com/documentation/web/download/web/, unzip it, run npm install, then follow the link you posted. After it finishes, you can copy the files under the lib folder to your app.
Let me know how this works and if you have any other questions.
optimize-for-prod.txt (12.2 KB)