unstale

npm / pdfjs-dist

pdfjs-dist

What changed in pdfjs-dist 5 to 6, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.

40 breaking8 security24 new APIs and options9 performance46 behavior and defaults66 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.0 on npm

pdfjs-dist 699 changes

Breaking changes 24

  • Font.ascent and Font.descent are no longer exported by default.

    6.4.299release notes

  • Font.defaultVMetrics is no longer exported by default.

    6.4.299release notes

  • Font.defaultWidth is no longer exported by default.

    6.4.299release notes

  • Font.mimetype is no longer exported.

    6.4.299release notes

  • Font.name is no longer exported by default.

    6.4.299release notes

  • The unused fallback parameter was removed from the localization getter.

    6.4.299release notes

  • ResetForm actions now reset descendants of non-terminal fields.

    6.4.299release notes

  • Validation of xref stream field widths is stricter, rejecting more malformed input.

    6.4.299release notes

  • Custom document information is now returned in a Map.

    6.3.289release notes

  • getFieldObjects now returns data in a Map instead of its previous representation.

    6.3.289release notes

  • getJSActions now returns data in a Map instead of its previous representation.

    6.3.289release notes

  • getPermissions now returns data in a Set instead of its previous representation.

    6.3.289release notes

  • markInfo now returns data in a Map instead of its previous representation.

    6.3.289release notes

  • getDestinations now returns its data in a Map.

    6.2.108release notes

  • getOpenAction now returns its data in a Map.

    6.2.108release notes

  • getViewerPreferences now returns its data in a Map.

    6.2.108release notes

  • The unused PageViewport method was removed.

    6.1.200release notes

  • getAttachments now returns attachment data in a Map.

    6.1.200release notes

  • Calling getDocument without a parameter object is no longer supported; callers must provide a parameter object.

    6.0.227release notes

  • The getXfaPageViewport helper moved into the XfaLayer class, so integrations using its previous location must update.

    6.0.227release notes

  • Chrome now uses ImageDecoder by default, changing image decoding behavior for applications running there.

    6.0.227release notes

  • The minimum supported browser versions were updated, and no longer needed polyfills were removed.

    6.0.227release notes

  • The PDFDocumentProxy.prototype.destroy method was removed, requiring applications to stop calling this API.

    6.0.227release notes

  • The Util.domMatrixToTransform method was removed and can no longer be used by applications.

    6.0.227release notes

Security 6

  • Automatic text-field sizing avoids a CPU denial-of-service condition.

    6.4.299release notes

  • CFF INDEX and FDArray parsing is bounded to constrain malformed font data.

    6.4.299release notes

  • Cumulative CMap range entries are now bounded to limit excessive input.

    6.4.299release notes

  • Embedded media content types are now validated before processing.

    6.4.299release notes

  • PDF.js: Arbitrary JavaScript execution upon opening a malicious PDF

    6.2.108security advisory

  • The viewer now includes a Content-Security-Policy, improving the security posture of the built-in viewer.

    6.0.227release notes

New APIs and options 13

  • The operationsFilter callback now receives the operatorList, enabling filtering decisions based on the complete operation list.

    6.4.299release notes

  • GeckoView gains typed signatures for its PDF.js integration.

    6.4.299release notes

  • Table structure attributes are exposed through the structure tree for consumers that inspect tagged PDF structure.

    6.3.289release notes

  • More tagged PDF structure roles are exposed to consumers inspecting document structure.

    6.3.289release notes

  • Digital signatures and certificates can be verified.

    6.2.108release notes

  • Sound annotations can play embedded audio.

    6.2.108release notes

  • GeckoView gains an import map entry for the digital signature properties manager.

    6.2.108release notes

  • Support was added for AuthEvent-based on-demand decryption.

    6.1.200release notes

  • RichMedia annotations are now supported.

    6.1.200release notes

  • The constructor now accepts an optional dictionary argument.

    6.1.200release notes

  • PDF.js now supports encrypted attachments, allowing applications to work with attachments protected by encryption.

    6.0.227release notes

  • PDF editing now supports inserting an image as a new page.

    6.0.227release notes

  • Binary data passed to PDFViewerApplication.open can now always include a filename.

    6.0.227release notes

Performance 3

  • Large JPEG images are downscaled with ImageDecoder, reducing resource use during decoding.

    6.3.289release notes

  • Shared font and image streams are deduplicated when PDFs are merged.

    6.1.200release notes

  • The built worker no longer bundles DOM-related code, reducing unnecessary worker bundle contents.

    6.0.227release notes

Behavior and default changes 15

  • FreeText appearances now use the platform print-to-PDF implementation.

    6.4.299release notes

  • Annotations are positioned using the structure tree.

    6.3.289release notes

  • The viewer supports two-finger panning, with zooming avoided during fast two-finger movement.

    6.3.289release notes

  • defaultOptions in web/app_options.js is now a Map.

    6.2.108release notes

  • Basic support was added for non-embedded TrebuchetMS fonts.

    6.2.108release notes

  • Entire-word search matching now uses Intl.Segmenter.

    6.2.108release notes

  • AES-256 revision 6 passwords now support SASLprep.

    6.2.108release notes

  • SmaskInData value 2 is supported for JPX images.

    6.2.108release notes

  • The text selection workaround is avoided in modern Chromium, and dark-mode selection contrast improves.

    6.2.108release notes

  • Annotation-layer rendering now uses checkbox and radio-button appearances defined in the PDF.

    6.1.200release notes

  • Installing the package no longer downloads Puppeteer browsers.

    6.1.200release notes

  • Screen annotations can now play embedded media.

    6.1.200release notes

  • The AnnotationLayer now supports Optional Content, enabling annotations associated with optional content groups.

    6.0.227release notes

  • The viewer can merge a PDF dropped onto the thumbnail viewer, adding another user-facing PDF editing workflow.

    6.0.227release notes

  • The viewer can merge several PDFs at once through the picker or drag-and-drop.

    6.0.227release notes

Fixes and other changes 38

  • Doc.resetForm now resets descendants of non-terminal fields.

    6.4.299release notes

  • ToUnicode mappings for unencoded glyphs are preserved in non-embedded Type1 fonts.

    6.4.299release notes

  • Fill-area computation is corrected for rotated tiling patterns.

    6.4.299release notes

  • Sampled functions no longer produce NaN values for degenerate domains.

    6.4.299release notes

  • Text-layer rendering now accounts for Firefox font-size quantization.

    6.4.299release notes

  • Text stroke width is corrected when the pixel-width cache is stale.

    6.4.299release notes

  • Text widgets now inherit text alignment from the AcroForm.

    6.4.299release notes

  • Transfer function arrays containing /Identity entries no longer cause crashes.

    6.4.299release notes

  • A software fallback was added for transfer maps, improving support when the accelerated path is unavailable.

    6.4.299release notes

  • Escaped literals are now preserved when formatting dates with util.printd.

    6.4.299release notes

  • PDF alternative text is exposed without prohibited ARIA names, improving accessibility integrations.

    6.3.289release notes

  • Cyclic field Parent chains no longer cause an infinite loop.

    6.3.289release notes

  • Scripts are added correctly when setting field actions.

    6.3.289release notes

  • Glyph mapping for non-embedded CID fonts is improved, producing more reliable text rendering.

    6.3.289release notes

  • PDF exports containing only images are handled correctly.

    6.3.289release notes

  • JPEG dimension mismatches are handled with ImageDecoder without resizing.

    6.3.289release notes

  • Invalid XML character references no longer cause an exception.

    6.3.289release notes

  • Marked content sections left open in a text object are automatically closed.

    6.3.289release notes

  • Numbers are no longer written in exponential notation when saving a PDF.

    6.3.289release notes

  • Selection rendering is corrected when a page is destroyed and rendered again.

    6.3.289release notes

  • Text is vertically centered in single-line and comb text fields.

    6.3.289release notes

  • Missing AcroForm fields are rebuilt, and inherited resources, appearances, flags, and signature fields are preserved or detected.

    6.2.108release notes

  • Decryption now handles non-ASCII passwords for AES-256 revision 5 PDFs.

    6.2.108release notes

  • The current editing session is committed before saving.

    6.2.108release notes

  • Non-local PDF link destinations are preserved.

    6.2.108release notes

  • OBJR children are preserved without restoring deleted pages.

    6.2.108release notes

  • Indirect and dangling structure tree root kids are handled.

    6.2.108release notes

  • Unicode names for destinations and attachments are preserved.

    6.2.108release notes

  • V=5 documents with a mislabeled AESV2 crypt filter now use AES256.

    6.1.200release notes

  • Annotation attachment content is re-derived from the xref after cleanup.

    6.1.200release notes

  • Comb text fields render more accurately, including vertically centered glyphs.

    6.1.200release notes

  • PDFs lacking a Kids array and containing an inline Page dictionary are now handled.

    6.1.200release notes

  • Selection rendering with this option disabled now works correctly.

    6.1.200release notes

  • Gray transparency groups are now rendered in grayscale.

    6.1.200release notes

  • JBIG2 file headers are stripped from JBIG2Decode streams.

    6.1.200release notes

  • Non-isolated blend-mode groups are now drawn against their backdrop.

    6.1.200release notes

  • Checkbox and radio export values are now resolved from the Opt entry.

    6.1.200release notes

  • Optional content configurations now serialize properly.

    6.1.200release notes

pdfjs-dist 594 changes

Breaking changes 16

  • The minimum supported Node.js version is now 22.

    5.7.284release notes

  • PostScriptCompiler and PostScriptEvaluator were removed because they are dead code.

    5.7.284release notes

  • The QuickJS sandbox now uses a Wasm file.

    5.7.284release notes

  • The enableHWA option was removed from viewer components.

    5.6.205release notes

  • Separate CMapReaderFactory, StandardFontDataFactory, and WasmFactory options were replaced by a single factory/option.

    5.6.205release notes

  • getDocument now requires one of data, range, or url to be provided.

    5.6.205release notes

  • The length parameter was removed from getDocument.

    5.6.205release notes

  • The deprecated PDFWorker.fromPort method was removed.

    5.6.205release notes

  • The xfatest command was removed.

    5.6.205release notes

  • Relevant BasePDFStream implementations now require an actual URL instance.

    5.5.207release notes

  • sendRequest is now asynchronous, changing how callers invoke and consume it.

    5.5.207release notes

  • The onDataProgress method was removed from PDFDataRangeTransport.

    5.5.207release notes

  • getTextContent is now asynchronous, so callers must handle its asynchronous result.

    5.5.207release notes

  • The minimum supported Google Chrome version is now 118.

    5.5.207release notes

  • deleteAnnotationElement now takes a full editor object.

    5.4.449release notes

  • FreeText annotations no longer support commenting because they do not have attached popups.

    5.4.394release notes

Security 2

  • PDF data is encrypted when merging the same PDF.

    5.7.284release notes

  • Usernames and passwords are removed from URLs.

    5.7.284release notes

New APIs and options 11

  • The viewer now provides UI for merging PDFs and prompts the user to save the merged PDF.

    5.7.284release notes

  • npx gulp server gained an option to allow external connections.

    5.6.205release notes

  • Gouraud-based shading is implemented using WebGPU.

    5.6.205release notes

  • PDF.js can extract selected pages from a PDF.

    5.6.205release notes

  • The viewer now supports deleting, cutting, copying, and pasting pages.

    5.5.207release notes

  • Pages in an extracted PDF can be reordered.

    5.4.624release notes

  • The thumbnail view gains a manage button for saving an edited PDF.

    5.4.624release notes

  • Some FontFaceObject properties can now be assigned through setters.

    5.4.449release notes

  • PDFs can be created by combining different source PDFs.

    5.4.449release notes

  • The viewer now exposes a sidebar object.

    5.4.449release notes

  • Text extraction is available through an external service.

    5.4.394release notes

Performance 6

  • Pattern creation is avoided for some basic gradients, reducing unnecessary rendering work.

    5.4.530release notes

  • Text rendering skips unnecessary pattern calculations, improving rendering performance.

    5.4.530release notes

  • Thumbnail handling uses slightly less memory.

    5.4.449release notes

  • Glyph lookup for annotation bounding boxes is more efficient.

    5.4.394release notes

  • Glyph paths use a binary format, improving path representation and processing efficiency.

    5.4.394release notes

  • Building the structure tree is faster.

    5.4.394release notes

Behavior and default changes 31

  • The Ink editor replaces its opacity slider with an alpha-enabled color input.

    5.7.284release notes

  • The CCITT fallback decoder was replaced with a JavaScript PDFium decoder.

    5.7.284release notes

  • Function-based shadings are now supported when rendering PDFs.

    5.7.284release notes

  • A GPU device is now created unconditionally, while mesh drawing uses it only above 16 triangles.

    5.7.284release notes

  • The JBig2 fallback decoder was replaced with a JavaScript PDFium decoder.

    5.7.284release notes

  • The thumbnail viewer now uses OffscreenCanvas unconditionally.

    5.7.284release notes

  • PDFDataRangeTransport now uses a single internal listener.

    5.7.284release notes

  • Merging and extracting PDFs can merge or update AcroForms.

    5.6.205release notes

  • Added annotations can be saved when reorganizing a PDF.

    5.6.205release notes

  • The worker thread now creates the filename for BaseCMapReaderFactory.

    5.6.205release notes

  • Hardware acceleration is enabled by default.

    5.6.205release notes

  • The maximum viewer scale increased to 2500 percent.

    5.6.205release notes

  • The onProgress callback consistently reports percent === NaN.

    5.6.205release notes

  • Outlines can be saved after PDF reorganization or merging.

    5.6.205release notes

  • The alt-text dialog toggle now downloads or deletes the model and enables or disables alt-text guessing.

    5.5.207release notes

  • The Annotation constructor now sets annotationType automatically.

    5.5.207release notes

  • PDF.js can now decompress Brotli-compressed data.

    5.5.207release notes

  • Keyboard shortcuts were added for copying, cutting, and deleting pages.

    5.5.207release notes

  • Loading progress is now reported automatically when using PDFDataTransportStream.

    5.5.207release notes

  • TH elements in tagged PDFs can now be interpreted as either column headers or row headers.

    5.5.207release notes

  • Deleting a comment can be undone.

    5.4.624release notes

  • PDFium's JBIG2 decoder is compiled into WebAssembly, changing how JBIG2 images are decoded.

    5.4.624release notes

  • Thumbnails can be dragged and dropped to reorganize pages, and the dropped thumbnail is selected.

    5.4.624release notes

  • The standard-font glyph map now includes additional Russian entries, improving rendering for affected text.

    5.4.530release notes

  • MathML text content is now aria-hidden and injected into MathML tags when they are in the structure tree, improving accessibility.

    5.4.530release notes

  • Edited comments can be saved using the CTRL+Enter shortcut.

    5.4.449release notes

  • The default max value in the XFA occur tag is now -1.

    5.4.449release notes

  • Editing buttons no longer use the radio role.

    5.4.394release notes

  • PT Astra Serif is available as a substitution for Times New Roman.

    5.4.394release notes

  • MathML elements are now visible in the structure tree.

    5.4.394release notes

  • StructTree now collects all child nodes of lists and tables.

    5.4.394release notes

Fixes and other changes 28

  • Attachments are preserved when merging or reorganizing a PDF.

    5.7.284release notes

  • Free-highlighting can now be applied on top of image placeholders.

    5.7.284release notes

  • TextLayerBuilder now works correctly when abortSignal is omitted.

    5.6.205release notes

  • Calling progressiveDone now resolves pending requests.

    5.5.207release notes

  • Text selection now works under search highlights.

    5.5.207release notes

  • Find-in-page continues to work correctly after pages are reorganized.

    5.4.624release notes

  • Links and the outline are corrected after reorganizing a PDF.

    5.4.624release notes

  • Local PDF requests smaller than two range requests no longer abort the full request, and standard ReadableStreams are used.

    5.4.624release notes

  • Accessibility artifacts associated with text and MathML are hidden from assistive technology and duplicate MathML labels are avoided.

    5.4.624release notes

  • Encoding was corrected for some missing Chinese fonts, improving font rendering.

    5.4.530release notes

  • CIDToGIDMap is used for Type 2 fonts with an OpenType font, improving glyph mapping.

    5.4.530release notes

  • File URL parameters are no longer decoded twice, preventing incorrect parameter handling.

    5.4.530release notes

  • Rendering no longer throws an exception for some glyph contours.

    5.4.530release notes

  • The JBIG2 decoder no longer enters an infinite loop when processing more than four referred-to segments.

    5.4.530release notes

  • The loca table length is corrected when sufficient space is available, improving font conversion correctness.

    5.4.530release notes

  • Strings matching ddd@d.dddd are no longer incorrectly treated as mail links.

    5.4.530release notes

  • Punctuation signs in search queries are escaped, improving search handling for punctuation-containing queries.

    5.4.530release notes

  • Named page destinations are updated when PDFs are combined.

    5.4.449release notes

  • The regex used to find characters normalized with NFKC during search was corrected.

    5.4.449release notes

  • Page labels are updated when a PDF is extracted.

    5.4.449release notes

  • Searching groups of punctuation signs now adds extra spaces only around the group.

    5.4.449release notes

  • Annotation positions in the DOM now follow their visual order.

    5.4.394release notes

  • Annotation DOM ordering uses annotation rectangles.

    5.4.394release notes

  • The annotation is correctly focused after its comment is removed in the annotation layer.

    5.4.394release notes

  • Deleting an editor removes its associated comment data.

    5.4.394release notes

  • The editor is focused after its comment is deleted.

    5.4.394release notes

  • All editors can receive focus from the keyboard.

    5.4.394release notes

  • Attributes in MathML tags no longer use the MathML namespace.

    5.4.394release notes