You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8fa8fc3
Browse filesBrowse the repository at this point in the historyBrowse files
| assets‑base | Directory URL of the viewer runtime files (`viewer.mjs`, `pdf.mjs`, `pdf.worker.min.mjs`, `viewer.css`, `paper-and-ink.css`). Only needed when your bundler does not handle `new URL('./file', import.meta.url)`, see [Bundlers](#bundlers-and-assets-base). | folder of `pdfjs-viewer-element.js`|
103
103
| worker‑src | PDF.js worker URL override. | bundled worker (`./build/pdf.worker.mjs` in dev, `pdf.worker.min.mjs` next to the element or in `assets-base`) |
-`locale` rebuilds the viewer so localization resources can be applied.
123
-
-`assets-base`and `locale-src-template` are read when the viewer is (re)initialized, so set them before the element is attached.
127
+
-`assets-base`, `pdfjs-lib-src`, `viewer-src`, `viewer-css-src`, `theme-css-src`and `locale-src-template` are read when the viewer is (re)initialized, so set them before the element is attached. Changing them alone does not reload the viewer.
124
128
125
129
## Bundlers and assets base
126
130
@@ -136,7 +140,7 @@ Bundlers that do not analyse `new URL(..., import.meta.url)`, esbuild among them
136
140
```
137
141
138
142
- The value is a directory URL, relative to the page or absolute. A trailing slash is added when missing.
139
-
-`worker-src` still takes precedence for the worker file.
143
+
-Individual runtime URL attributes take precedence over `assets-base` for their respective files, including `worker-src`.
140
144
- The attribute is read when the viewer is (re)initialized, so set it before the element is attached to the document.
141
145
142
146
PDF.js annotation icons are a separate case: the viewer loads them at runtime as `imageResourcesPath + 'annotation-' + name + '.svg'`, a dynamic name no bundler can emit. If `assets-base` is set, `imageResourcesPath` defaults to `assets-base + 'images/'`. Otherwise serve the package `dist/images` folder and set `image-resources-path` explicitly.
0 commit comments