Repository navigation
Features
-
PDF.js 6.5.438, up from 6.4.299. This PDF.js release improves accessibility, annotation editing and rendering, font and image conversion, performance, scripting and the viewer. See the PDF.js release notes. (#77)
-
Drawing pages in a worker, and
renderer-src. PDF.js 6.5 can draw pages in a second worker instead of on the main thread. PDF.js ships with it turned off. To turn it on, set the option before the viewer is built, for example onDOMContentLoaded:viewerElement.setViewerOptions({ disableWorkerRendering: false })
The new
renderer-srcattribute sets the URL of that worker's script. It defaults topdf.renderer.min.mjsnext to the element, or insideassets-base, so you only need it when the file is served from somewhere else. The viewer's CSP allows the script's origin. If the worker can't start, PDF.js logs a "Renderer worker disabled" warning and draws on the main thread. Seedemo/worker-rendering.html. (#77)
Fixes
- The
open()parameter type no longer includesUint8Array. PDF.js rejects bare bytes at runtime withgetDocument - expected either `data`, `range`, or `url` parameter. TypeScript now reports the mistake at compile time. Pass{ data: bytes }instead. (#76, #79)
Upgrading
There are no breaking changes, and worker rendering stays off unless you turn it on.
- A
worker-srcpinned to a pdfjs-dist version, such as a CDN URL withpdfjs-dist@6.4.299, must move to 6.5.438. PDF.js refuses a worker from another version withThe API version "6.5.438" does not match the Worker version "6.4.299". - A copy of
distserved withassets-basemust be replaced with this release'sdist, as with every release. The copy now includespdf.renderer.min.mjs(175 kB), which loads only when worker rendering is on. - TypeScript code that passed a
Uint8Arraytoopen()no longer compiles. Wrap the bytes as{ data }. The old call already failed at runtime.
For contributors
- Four tests passed even when the feature they cover was broken: the render, wrong-URL, base64 and shipped-resources tests. Each now fails when its feature breaks. No test depends on a PDF that exists only on one machine. (#76, #79)
- Development dependencies updated: Vitest 5.1.0 and
@types/node26.6.6. (#74)
Full changelog: v4.4.2...v4.5.0