If you experience slow page loading with PDF SDK for Web, use Chrome Dev Tools to inspect your Network activity to check if the slowness is related to repeat file loading. If so, you should consider using a cache policy on static assets to optimize repeat page load speed. PDF SDK for Web allows a temporary and permanent cache on files. The cache code sample is available at ..\examples\PDFViewCtrl\service-worker in the Web SDK package.
1. Cacheable files:
The following files and folders (file resources) highlighted in blue can be temporarily cached.
2. Permanently cacheable files:
- Resources referenced internally inside the Web viewer: lib/ webpdfjrworker.js, lib/locales and lib/jr-engine.
- Font files used to render PDFs: external/brotli
These files are versions with hashes. The Web viewer monitors the hash value. If the value is the same, the Web viewer serves resources from the cache. If the value has been changed, the Web viewer adjusts the cache invalidation, serves the file from server, and caches it again.
Permanently Cacheable Resources (highlighted in blue)