github mozilla/pdf.js v5.0.375

one day ago

PDF.js 5.0 is a major release that contains a number of API changes, features and bugfixes.

The following significant new features are highlighted:

  • Improved JPEG 2000 decoding support
    • The OpenJPEG decoder was moved into a separate .wasm file, which requires setting a new wasmUrl API option in order to use it; see PR #19329.
    • A (much slower) JavaScript OpenJPEG fallback decoder was added (also uses the wasmUrl API option) for environments without WebAssembly support; see PR #19525.
  • Support for ICC profiles
    • This requires WebAssembly support, and that the wasmUrl API option is set; see PR #19564.
    • Use an ICC profile to improve CMYK to RGB color conversion, which requires setting a new iccUrl API option in order to use it; see PR #19620.
    • Currently Lab profiles are not supported, which is tracked in bug 1717767.
  • Improved rendering of large pages in the viewer
    • Render the currently visible portion of pages at full resolution, once we've reached the size limits and are falling back to CSS-zooming; see PR #19128.
    • Limit the maximum canvas dimensions, to avoid rendering breaking and canvases being empty; see PR #19604.
  • Enable creation of hyperlinks, in the viewer, from text that look like URLs
    • This is disabled by default because of some remaining issues, but can be enabled in the viewer with the enableAutoLinking option/preference; see PR #19110.

The following significant changes are highlighted (which may require changes in third-party PDF.js implementations):

  • Addition of a couple of new CSS variables, that e.g. the text and annotation layers now depend upon; see PR #19469.
  • Removal of a couple of old exceptions; see PR #19264.

The complete list of changes in this release is shown below. If you're upgrading to PDF.js 5.0 we recommend checking the changes prefixed with [api-minor] and [api-major] since those might require updates to your code.

Changes since v4.10.38

  • Bump the stable version in pdfjs.config by @timvandermeij in #19276
  • Remove the getSelectedEditors integration test helper function by @timvandermeij in #19277
  • Use Dict iteration more (PR 19051 follow-up) by @Snuffleupagus in #19278
  • Skip LinkAnnotations when collecting field objects (issue 19281) by @Snuffleupagus in #19289
  • Use the waitForUnselectedEditor integration test helper function more by @timvandermeij in #19290
  • Implement a commit helper function for the freetext integration tests by @timvandermeij in #19291
  • Let be more tolerant with predefined phone number format by @calixteman in #19280
  • Update the toggle-button css after the changes in m-c (bug 1940085) by @calixteman in #19295
  • Remove unused CSS variables by @calixteman in #19300
  • Remove the fuzz tests (issue 19297) by @Snuffleupagus in #19307
  • Access the bbox/background data correctly in the MeshShadingPattern class (issue 18816) by @Snuffleupagus in #19305
  • [Editor] Set a unique id for each element in the draw layer by @calixteman in #19309
  • [Editor] Don't try to use an non-existing canvas when rendering an in visible existing stamp editor by @calixteman in #19311
  • [Editor] Improve zooming with a pinch gesture while drawing by @calixteman in #19312
  • Update dependencies to the most recent versions by @timvandermeij in #19313
  • Re-use existing helper functions in FontRendererFactory by @Snuffleupagus in #19317
  • Upgrade Puppeteer to version 24.0.0 by @timvandermeij in #19318
  • Improve performance when reading very large TrueType "cmap" tables (issue 19319) by @Snuffleupagus in #19321
  • Enable editor when double-clicking on stamp annotation by @nicolo-ribaudo in #19320
  • Access the number of components correctly in JPEG 2000 images with color space entries (issue 19326) by @Snuffleupagus in #19327
  • Allow searching for number-number on two lines by @nicolo-ribaudo in #19324
  • [api-major] Add openjpeg.wasm to pdf.js (bug 1935076) by @calixteman in #19329
  • [api-major] Replace MissingPDFException and UnexpectedResponseException with one exception by @Snuffleupagus in #19264
  • Bump library version to 5.0 by @Snuffleupagus in #19332
  • Handle JPX wasm fetch-response errors correctly (PR 19329 follow-up) by @Snuffleupagus in #19333
  • Reduce console spam when running tests in Firefox by @Snuffleupagus in #19335
  • Handle the case where openjpeg.wasm is missing by @calixteman in #19340
  • Simplify the JSDocs for the various getDocument Factory-parameters by @Snuffleupagus in #19331
  • Inline the default Factory-definitions in getDocument by @Snuffleupagus in #19341
  • Update dependencies to the most recent versions by @timvandermeij in #19342
  • Implement helper functions for (un)selecting an editor in the integration tests by @timvandermeij in #19344
  • Centralize the editor selector definitions in the stamp editor integration tests by @timvandermeij in #19350
  • Centralize the editor selector definitions in the ink editor integration tests by @timvandermeij in #19351
  • Replace the EXIF-block with dummy data to prevent JPEG images being rotated (bug 1942064) by @Snuffleupagus in #19356
  • Enable the import/no-restricted-paths ESLint plugin rule for the viewer by @Snuffleupagus in #19353
  • Support multiple wasm-files in the development viewer by @Snuffleupagus in #19337
  • Correctly render the glyph outline when it has a stroke pattern by @calixteman in #19361
  • [Editor] Ensure that highlightSelection waits until we've fully updated the editing-mode (issue 19369) by @Snuffleupagus in #19371
  • [GENERIC viewer] Re-initialize the viewer-toolbar ColorPicker for each PDF document by @Snuffleupagus in #19372
  • [Editor] Don't scroll when drawing (issue 17327) by @avdoseferovic in #19338
  • [api-major] Change viewer component render-methods to take parameter objects by @Snuffleupagus in #19365
  • [Editor] Add validation for the target element of curve endpoints by @Hydraulicus in #19373
  • Bump undici from 6.19.8 to 6.21.1 by @dependabot in #19382
  • Remove unused isInEditingMode method (PR 19311 follow-up) by @Snuffleupagus in #19381
  • Enable the "checks that the viewer re-exports the expected API functionality" unit-test in Node.js by @Snuffleupagus in #19358
  • [api-minor] Simplify clean-up of page resources after rendering by @Snuffleupagus in #19368
  • Handle empty BigInt64Array/BigUint64Array in the isNumberArray helper by @Snuffleupagus in #19384
  • Introduce a readInt16 helper function in the src/core/core_utils.js file by @Snuffleupagus in #19388
  • Support the password field-flag in TextWidgetAnnotation (issue 19389) by @Snuffleupagus in #19390
  • [Editor] (WIP) Add a new tool in order to add an handwritten signature to a pdf (bug 1942343) by @calixteman in #19339
  • Initialize the image-options, on the worker-thread, once per document by @Snuffleupagus in #19392
  • Use fewer hasFieldFlag calls in the src/core/annotation.js file by @Snuffleupagus in #19393
  • Move the array containing the supported image mime types in display_utils by @calixteman in #19394
  • Avoid to remove the active overlay when a cancelled dialog (like the file picker) was called from a dialog by @calixteman in #19395
  • [Editor] Add some functions in order to extract contours from text and to generate a drawing from a drawn signature by @calixteman in #19396
  • Add width/height getters in the Annotation class by @Snuffleupagus in #19397
  • Add width/height getters in the AnnotationElement class by @Snuffleupagus in #19402
  • Replace uninformative README badge (issue 19406) by @hamirmahal in #19407
  • Update dependencies and translations to the most recent versions by @timvandermeij in #19404
  • Centralize the editor selector definitions in the highlight editor integration tests by @timvandermeij in #19405
  • Remove the color-mix fallback used with PopupAnnotations by @Snuffleupagus in #19408
  • Centralize the editor selector definitions in the freetext editor integration tests by @timvandermeij in #19410
  • Bundle wasm-files in pdfjs-dist (PR 19329 follow-up) by @Snuffleupagus in #19415
  • [api-minor] Add more validation for the cMapUrl, standardFontDataUrl, and wasmUrl parameters by @Snuffleupagus in #19416
  • [Editor] Add a new dialog for the signature editor (bug 1945574) by @calixteman in #19414
  • Enable automatic URL linking (bug 1019475) by @ryzokuken in #19110
  • Enable autolinking in Firefox (bug 1019475) by @calixteman in #19429
  • Fix --save-warning-color CSS variable typo (PR 19414 follow-up) by @Snuffleupagus in #19431
  • [GENERIC viewer] Add Fluent PLATFORM function (PR 19414 follow-up) by @Snuffleupagus in #19430
  • Use the FeatureTest helper in the src/display/font_loader.js file by @Snuffleupagus in #19432
  • [Editor] Add an icon for the signature tool and move it before the highlight one by @calixteman in #19433
  • Disable the "Blank issue" alternative when using the GitHub "New issue"-button by @Snuffleupagus in #19419
  • Use the getPdfColorArray helper more in the src/core/annotation.js file by @Snuffleupagus in #19423
  • Combine the main-thread message handlers for CMap-, StandardFontData-, and Wasm-files by @Snuffleupagus in #19436
  • [api-minor] Simplify the TextLayer.#getAscent fallback (PR 12896 follow-up) by @Snuffleupagus in #19399
  • Use crypto.getRandomValues unconditionally in the src/core/crypto.js file by @Snuffleupagus in #19450
  • Check for the correct link-id prefix in "must not add links when unnecessary" integration-test (PR 19110 follow-up) by @Snuffleupagus in #19447
  • Shorten the MeshStreamReader.prototype.readBits method a little bit by @Snuffleupagus in #19446
  • [api-minor] Update the minimum supported Google Chrome version to 110 by @Snuffleupagus in #19454
  • [Editor] Add the ability to print and save some newly added signatures (bug 1946795) by @calixteman in #19437
  • Replace a couple of loops with TypedArray.prototype.fill() by @Snuffleupagus in #19456
  • Isolate the ink editor integration tests by @timvandermeij in #19457
  • Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up) by @Snuffleupagus in #19449
  • Check that the annotationLayer is still active before injecting inferred links (PR 19110 follow-up) by @Snuffleupagus in #19460
  • Update dependencies and translations to the most recent versions by @timvandermeij in #19458
  • Create the borderStyle of inferred links lazily (PR 19110 follow-up) by @Snuffleupagus in #19461
  • [Editor] Add the possibility to compress/decompress the signature data in order to store them in the logins storage in Firefox (bug 1946171) by @calixteman in #19425
  • Catch and ignore any errors during auto-linking parsing (PR 19110 follow-up) by @Snuffleupagus in #19464
  • Fix the color of the background button when hovering it by @calixteman in #19472
  • [api-major] Apply the userUnit using CSS, to fix the text/annotation layers (bug 1947248) by @Snuffleupagus in #19469
  • [Editor] Populate the 'Add signature' menu with the saved signatures (bug 1947828) by @calixteman in #19478
  • Slightly shorten an Array.from usage in the SignatureManager class by @Snuffleupagus in #19485
  • Move the auto-link handling into its own PDFPageView helper-method, and dispatch a "linkannotationsadded" event by @Snuffleupagus in #19475
  • [GenericL10n] Fetch the language bundles in parallel to reduce load time by @Snuffleupagus in #19481
  • [Editor] Add the possibility to change a signature description (bug 1948116) by @calixteman in #19486
  • Add a new closeIfActive method in the OverlayManager class by @Snuffleupagus in #19487
  • Search for destinations in both /Names and /Dests dictionaries (issue 19474) by @Snuffleupagus in #19476
  • Add some unicode mapping for ligatures when writing the cmap table in the font (bug 1946181) by @calixteman in #19427
  • Shorten the CipherTransformFactory.prototype.#buildObjectKey method by @Snuffleupagus in #19496
  • Check more of the stream when looking for commands after inline image (issue 19494) by @Snuffleupagus in #19495
  • Ensure that the useWorkerFetch fallback value is always a boolean by @Snuffleupagus in #19499
  • [Editor] Add two integration tests for the signature UI by @calixteman in #19500
  • Remove a few eslint-disable statements in the web/ folder by @Snuffleupagus in #19503
  • [Editor] Add a scrollbar to the signature doorhanger when it's overflowing (bug 1948771) by @calixteman in #19507
  • [Editor] Scale the signature editor when it's too large (bug 1948741) by @calixteman in #19506
  • [JS] Skip throwing actions by @calixteman in #19508
  • [Editor] Wait for switching to stamp mode before adding a new editor when dnd'ing an image by @calixteman in #19511
  • Fix all outstanding ESLint arrow-body-style warnings by @Snuffleupagus in #19504
  • [Editor] Add two integration tests for the signature feature by @calixteman in #19512
  • Don't cache free/missing XRef entries (issue 19510) by @Snuffleupagus in #19513
  • Fix autolinking errors by @ryzokuken in #19470
  • [Editor] Remove the error panel when the user click on an other tab (bug 1949201) by @calixteman in #19516
  • [Editor] Make the editing toolbar buttons text visible when hovered in HCM with Desert theme (bug 1949417) by @calixteman in #19522
  • [Editor] Fix the outline of a focused button in the doorhanger while navigating with the keyboard by @calixteman in #19523
  • [Editor] Fix the color of the labels in the editing doorhangers by @calixteman in #19524
  • Move the EXIF-block replacement into JpegStream (PR 19356 follow-up) by @Snuffleupagus in #19518
  • Introduce some URL.parse() usage in the code-base by @Snuffleupagus in #19493
  • Consider textRise when showing Type3 font glyphs (issue 19532) by @Xiphoseer in #19533
  • [api-minor] Render high-res partial page views when falling back to CSS zoom (bug 1492303) by @nicolo-ribaudo in #19128
  • [Editor] Add a test for copy & paste a signature editor by @calixteman in #19534
  • Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076) by @calixteman in #19525
  • Disable the loading of node types in the type tests by @stof in #19531
  • [api-minor] Re-factor how the useWorkerFetch option is used internally by @Snuffleupagus in #19537
  • [Editor] Fix the position in the page of a drawing after it has been moved with the keyboard by @calixteman in #19538
  • Update dependencies and translations to the most recent versions by @timvandermeij in #19542
  • Refactor the editor integration test helper functions by @timvandermeij in #19543
  • Fix the link for issue5939.pdf by @hecerinc in #19545
  • [Editor] Shift the signature editor when pasted by @calixteman in #19539
  • Add a comment 'THIS FILE IS GENERATED - DO NOT EDIT' in openjpeg files generated with emscripten by @calixteman in #19552
  • Fix the assert in FontLoader.prototype.loadSystemFont by @Snuffleupagus in #19551
  • [Editor] Add some telemetry for the signature editor (bug 1945827) by @calixteman in #19554
  • Pad rev 4 encryption keys to be >= 16 bytes (issue 19484) by @rossj in #19555
  • Reset #renderError on RenderingCancelledException (PR 19128 follow-up) by @Snuffleupagus in #19558
  • Send disableFontFace and fontExtraProperties as part of the exported font-data by @Snuffleupagus in #19548
  • [Editor] Fix the telemetry for the signature stuff by @calixteman in #19565
  • [api-minor] Stop exporting, by default, a few additional Font properties (PR 11777 follow-up) by @Snuffleupagus in #19549
  • Use more local variables in PDFViewerApplication._initializeViewerComponents by @Snuffleupagus in #19556
  • Abort various timeouts, in PDFViewer, when closing the document (PR 19128 follow-up) by @Snuffleupagus in #19557
  • Extend getGlyphMapForStandardFonts with some Cyrillic entries (issue 19550) by @Snuffleupagus in #19562
  • Invoke TranslatedFont.prototype.loadType3Data only once per font by @Snuffleupagus in #19563
  • Don't attempt to use auto-linking in XFA documents (PR 19110 follow-up) by @Snuffleupagus in #19574
  • Reenable viewerCssTheme option for Firefox by @hecerinc in #19544
  • Fix the build of the openjpeg decoder in order to use an optimized build of the openjpeg library (bug 1951128) by @calixteman in #19584
  • Add a GlobalColorSpaceCache to reduce unnecessary re-parsing by @Snuffleupagus in #19583
  • Try reducing flakiness of CSS-only zoom test by @nicolo-ribaudo in #19578
  • Add the missing return type for PDFWorker.fromPort() by @yjoer in #19571
  • Don't bundle the FakeMLManager class in regular builds by @Snuffleupagus in #19568
  • Replace a loop with TypedArray.prototype.fill() in the RunLengthStream class by @Snuffleupagus in #19589
  • Write string-data into the .error-file created for broken test-manifest links (issue 19579) by @Snuffleupagus in #19581
  • Be sure to consume responses in case of error in downloading test files (issue 19580) by @dhdaines in #19582
  • Re-use the isValidExplicitDest helper function in the worker/viewer by @Snuffleupagus in #19577
  • Use arrow function with various Array methods by @Snuffleupagus in #19596
  • Fix autolinking with highlighted search results by @nicolo-ribaudo in #19576
  • Use arrow functions with some Promise.then calls by @Snuffleupagus in #19597
  • Also cache "sub" ColorSpaces globally (PR 19583 follow-up) by @Snuffleupagus in #19598
  • [api-minor] Limit the maximum canvas width/height, in addition to its total area (bug 1943094) by @Snuffleupagus in #19604
  • Use the latest emsdk version to compile openjpeg decoder by @calixteman in #19585
  • [api-minor] Support using ICC profiles in using qcms (bug 860023) by @calixteman in #19564
  • Remove ColorSpaceUtils.parseAsync and simplify the ColorSpace "API-surface" by @Snuffleupagus in #19599
  • Simplify the ColorSpaceUtils.singletons handling (PR 19564 follow-up) by @Snuffleupagus in #19607
  • Update l10n files by @Snuffleupagus in #19608
  • [Editor] Remove the unused opacityToHex helper function (PR 19093 follow-up) by @Snuffleupagus in #19610
  • Introduce a helper function for clamping a value to a range by @Snuffleupagus in #19617
  • [Editor] In edit mode, a non-editable stamp must be visible after the page is rendered by @calixteman in #19618
  • Fix the #savedHasOwnCanvas handling in the StampAnnotation class by @Snuffleupagus in #19619
  • Do not constantly render the detail canvas on zoom (bug 1952496) by @nicolo-ribaudo in #19622
  • Use the MathClamp helper function more (PR 19617 follow-up) by @Snuffleupagus in #19628
  • Remove the PDFFunctionFactory.createFromArray method by @Snuffleupagus in #19623
  • Re-factor the src/core/crypto.js file by @Snuffleupagus in #19629
  • Limit the maximum thumbnail canvas width/height, similar to pages (PR 19604 follow-up) by @Snuffleupagus in #19621
  • Let SMask/Mask images fallback to the parent image dimensions (issue 19611) by @Snuffleupagus in #19613
  • Improve text-selection for Type3 fonts, using d0 operators, with empty /FontBBox-entries (issue 19624) by @Snuffleupagus in #19625
  • Support the maxCanvasPixels option in the thumbnails code by @Snuffleupagus in #19635
  • [api-minor] Use an icc profile for converting CMYK to RGB by @calixteman in #19620
  • [Editor] Make sure the save checkbox isn't focusable when saving is disabled (bug 1952558) by @calixteman in #19636
  • [Editor] Add an aria label to an added signature (bug 1952571) by @calixteman in #19637
  • Always use the absolute value of the line thickness (issue 19633) by @calixteman in #19639
  • Don't close the secondaryToolbar when clicking inside it (PR 18385 follow-up) by @Snuffleupagus in #19640
  • [Editor] Fix the style of the buttons in dialog (bug 1953003) by @calixteman in #19642
  • Let Lexer.prototype.getNumber treat more cases of a single minus sign as zero (bug 1953099) by @Snuffleupagus in #19647
  • Don't shadow the TouchManager.prototype.MIN_TOUCH_DISTANCE_TO_PINCH value by @Snuffleupagus in #19646
  • Update l10n files by @Snuffleupagus in #19643
  • Introduce a common base class for the PDF17 and PDF20 crypto classes by @Snuffleupagus in #19644
  • Add an OutputScale static method to get the devicePixelRatio by @Snuffleupagus in #19645
  • [Editor] Fix the role of the different editors in order to make them interactive elements (bug 1953290) by @calixteman in #19648
  • Shorten the src/core/crypto.js file a little bit by @Snuffleupagus in #19650
  • [Editor] Fix the title of saved signature button (bug 1953298) by @calixteman in #19649
  • [Editor] Fix variable name in the ftl file by @calixteman in #19651
  • [Editor] Remove useless css variable by @calixteman in #19652
  • Remove all the translatable strings from the html by @calixteman in #19653
  • Replace the regular expression in GenericL10n.#getPaths with simple string parsing by @Snuffleupagus in #19657
  • Slightly shorten a couple of MeshStreamReader methods by @Snuffleupagus in #19656
  • Inline the PDFThumbnailView.prototype.#finishRenderTask helper method by @Snuffleupagus in #19661

Don't miss a new pdf.js release

NewReleases is sending notifications on new releases.