PDF.js v2.6.347 Release Notes

Release Date: 2020-09-03 // over 3 years ago
  • πŸ›  This release features support for form filling (AcroForm) and layers (optional content). Moreover, the default viewer is redesigned to match Firefox's Photon design, TypeScript definitions are shipped and various performance improvements and bugfixes are included.

    πŸ”„ Changes since v2.5.207:

    πŸš€ #11948 Bump versions in pdfjs.config and update the getting started page of the website for the new release
    🚚 #11958 [api-minor] Remove the deprecated PDFDocumentProxy.getOpenActionDestination method (PR 11644 follow-up)
    #11967 Do not transform jpeg RGB components
    #11964 Fix pdfjs-dist/webpack causing errors with certain configs
    #11953 For #11838: trigger fallback bar after user clicks in pdf
    #11972 Change the loadedChunks property, on ChunkedStream instances, from an Array to a Set
    #11963 Avoid calling Math.pow if possible.
    #11974 A couple of small image caching/sending improvements
    🚚 #11976 Remove unused methods from NetworkManager, in src/display/network.js
    βœ… #11978 Improve unit test coverage for primitives
    #11977 Convert the RefSet primitive to a proper class and use a Set internally
    🚚 #11985 Convert some Objects to Maps in ChunkedStreamManager, and move the isEmptyObj helper function to the test utils
    ⚑️ #11987 Update SVGGraphics to account for globally cached images (PR 11912 follow-up)
    #11992 Prevent the (old) preprocessor from appending trailing whitespace when removing closing HTML comments
    #11993 Change the dependencies property, on OperatorList instances, from an Object to a Set
    πŸ‘ #11969 For #11961: collect telemetry on all unique unsupported features that…
    πŸ‘ #11997 Add basic support for the nullish coalescing operator ??
    ⚑️ #11999 Update packages and translations
    πŸ— #12000 Ensure that PDFImage.buildImage won't accidentally swallow errors, e.g. from ColorSpace parsing (issue 6707, PR 11601 follow-up)
    #12001 Add local caching of ColorSpaces, by name, in PartialEvaluator.getOperatorList (issue 2504)
    #12002 Small improvements in CFFCompiler.encodeNumber and CFFCompiler.encodeFloat
    πŸ‘· #12004 Convert the code in src/core/worker.js to use ES6 classes
    πŸ“œ #12005 Convert the code in src/core/cff_parser.js to use ES6 classes
    #12017 Convert the PDFPageProxy.intentStates property from an Object to a Map
    #12016 Tweak the QueueOptimizer to recognize OPS.paintImageMaskXObject operators as repeated when the "skew" transformation matrix elements are non-zero (issue 8078)
    🚚 #12021 Move the fetchBuiltInCMap method to the PartialEvaluator.prototype
    πŸ“œ #12012 Improve (local) caching of parsed ColorSpaces (PR 12001 follow-up)
    ⚑️ #12024 Update Needle to 2.5.0 or greater.
    #12028 Attempt to detect inline images which contain "EI" sequence in the actual image data (issue 11124)
    ⚑️ #12032 Update packages and translations
    #12041 Replace Mozilla Labs by just Mozilla
    πŸ‘• #12049 Enable the no-promise-executor-return ESLint rule
    #12036 Add at least some test-coverage for the RenderTask.onContinue functionality
    βœ… #12043 Add a reduced test-case for issue 4260 (PR 4521 follow-up)
    #12044 Adjust the heuristics used when dealing with rectangles, i.e. re operators, with zero width/height (issue 12010)
    #12040 Replace non-inclusive "whitelist" term with "allowlist"
    0️⃣ #12039 [api-minor] Use the NodeCanvasFactory/NodeCMapReaderFactory classes as defaults in Node.js environments (issue 11900)
    #12034 Add local caching of Functions, by reference, in the PDFFunctionFactory (issue 2541)
    #12057 Allow BaseLocalCache to, optionally, only allocate storage for caching of references (PR 12034 follow-up)
    #12059 Convert the code in src/core/image.js to use ES6 classes
    #12060 Convert the code in src/core/evaluator.js to use standard classes
    #12072 Bump npm from 6.14.5 to 6.14.6
    πŸ”¨ #12056 Refactor/simplify the "delayedFallback" handling in the default viewer
    🚚 #12070 Re-factor the idFactory functionality, used in the core/-code, and move the fontID generation into it
    🚚 #12083 Remove the IR (internal representation) part of the ColorSpace parsing
    #12063 Tweak the heuristic, in src/core/jpg.js, that handles JPEG images with a wildly incorrect SOF (Start of Frame) scanLines parameter (issue 10989)
    ⚑️ #12092 Update packages and translations
    πŸ“œ #12090 Stop special-casing the (very unlikely) "no /XObject found"-scenario, when parsing OPS.paintXObject operators, in PartialEvaluator.{getOperatorList, getTextContent}
    #12099 Use a RefSet, rather than a plain Object, for tracking already processed nodes in PartialEvaluator.hasBlendModes
    #12085 Make the detection of Node.js environments on Electron strict.
    #12089 Convert RefSetCache to a proper class and to use a Map internally
    #12087 Add local caching of "simple" Graphics State (ExtGState) data in PartialEvaluator.{getOperatorList, getTextContent} (issue 2813)
    #12101 Add a new size getter and getRawValues method, to Dict instances, to simplify some code
    πŸ–¨ #12023 Fix auto-rotate for printing landscape PDFs where the first page is also landscape
    🚚 #12114 Remove a couple of unnecessary PDFJSDev checks from the viewer
    #12106 [api-minor] Add an annotation storage in order to save annotation data in acroforms
    ⚑️ #12122 Update packages and translations
    βœ… #12124 Include the browser name when printing unit-test results
    βœ… #12126 Attempt to reduce intermittent failures in the "cleans up document resources during rendering of page" unit-test
    βœ… #12125 Improve test bot stability
    #12127 Improve how Type3-fonts with dependencies are handled
    🚚 #12135 [src/core/worker.js] Remove a useless Promise handler from the pdfManagerReady function
    #12136 Ignore fetch() errors, in PDFFetchStreamRangeReader, once the request has been aborted
    πŸ–¨ #12107 Add support for checkboxes printing
    βœ… #12143 Fix hanging reference test (PR 12107 follow-up)
    #12141 Populate the find field with the search query when URL has #search hash
    βœ… #12147 [api-minor] Fix the AnnotationStorage usage properly in the viewer/tests (PR 12107 and 12143 follow-up)
    βœ… #12144 Prevent Uncaught (in promise) AbortException when running the unit-tests
    βͺ #12148 Revert "Populate the find field with the search query when URL has #search hash"
    #12131 [api-minor] Allow loading pdf fonts into another document.
    βͺ #12151 Revert "[api-minor] Allow loading pdf fonts into another document."
    βœ… #12153 Unit test improvements
    πŸ–¨ #12108 Add support for radios printing
    #12102 Add types annotations
    #12162 Tweak for the type of PageViewportParameters.viewBox (PR 12102 follow-up)
    #12161 Add types to functions exported as API in src/pdf.js (PR 12102 follow-up)
    #12157 Fix the type of SVGGraphics (PR 12102 follow-up)
    πŸ‘· #12160 Use typedef to define the type of GlobalWorkerOptions (PR 12102 follow-up)
    πŸ‘ #12095 Add support for optional marked content.
    πŸ“š #12156 Improve the types generation and API documentation (PR 12102 follow-up)
    #12163 Re-factor the dispatching of "attachmentsloaded" events, when the PDF document contains no "regular" attachments
    βœ… #12171 Attempt to reduce intermittent failures in the "multiple render() on the same canvas" unit-test
    🏁 #12168 Fix the gulp types task to run on Windows, and place the TypeScript definitions correctly in pdfjs-dist
    #12172 Fix the type definition of TypedArray. (PR 12156 follow-up)
    πŸ–¨ #12174 Do the AppOptions.get("printResolution") lookup once in web/app.js, when initializing PDFPrintServiceFactory-instances, rather than for every printed page
    #12173 [api-minor] Fix the annotationStorage parameter in PDFPageProxy.render
    πŸ‘ #12179 Add support for Object.fromEntries
    #12169 Extract common methods from PDFOutlineViewer/PDFAttachmentViewer into a new abstract BaseTreeViewer class
    πŸ–¨ #12175 Support textfield and choice widgets for printing
    #12182 Fix the type of PDFDocumentLoadingTask.destroy.
    #12154 [api-minor] Allow loading pdf fonts into another document.
    βœ… #12187 Add a test-case for issue 4398
    ⚑️ #12188 Update packages and translations
    πŸ–¨ #12176 Support multiline textfields for printing
    πŸ–¨ #12177 Support comb textfields for printing
    #12186 Fix bad truetype loca tables.
    #12192 A couple of (small) tweaks of the AnnotationStorage (PR 12173 follow-up)
    πŸ–¨ #12193 Set direction: ltr; on the canvases used during printing (bug 1335712)
    🚚 #12191 Remove the disableCreateObjectURL option from web/app_options.js
    πŸ‘ #12137 Add support for saving forms
    0️⃣ #12201 Enable renderInteractiveForms by default.
    #12211 Wait until saving has finished before resetting PDFViewerApplication._saveInProgress (PR 12137 follow-up)
    #12212 Bug 1643508 - Disable touch-based pinch zooming on pdf.js.
    #12210 Keep the original class/function names when minifying code (issue 12209)
    🍎 #12203 Bug 1392361 - Fix zooming sensitivity on macOS
    πŸ‘ #12219 Add (basic) support for transfer functions to Images (issue 6931, bug 1149713)
    #12227 Include image_decoders-es5/minified-es5 in the pdfjs-dist library (issue 12220)
    #12229 Dispatch event when annotations have finished rendering.
    βœ… #12230 Implement reference testing for printing
    ⚑️ #12250 Update the zoom dropdown width calculation to work better in locales with long zoom-strings (PR 11077 follow-up)
    #12251 Return the query with the findcontrolstate
    #12241 confirm if leaving a modified form without saving
    πŸ‘ #12248 Support file save triggered from the Firefox integrated version.
    πŸ“œ #12247 Improve the field value parsing for choice widgets to handle null values
    🚚 #12256 #12241 followup - move event listener to PDFViewerApplication.load
    πŸ‘· #12244 fix webpack config problem caused by breaking changes of worker-loader
    #12260 Replace menu dropdown icon
    0️⃣ #12261 Also enable renderInteractiveForms by default in the viewer components (PR 12201 follow-up)
    πŸ–¨ #12265 Don't warn when navigating away from a modified form, if printing has occurred (issue 12262)
    ⚑️ #12267 Update packages and translations
    πŸ–¨ #12263 Fix AcroForm printing/saving edge cases
    #12268 Reduce the leading padding for the numPages span (PR 11077 follow-up)
    #12270 Accent positioning in Type1 seac glyphs
    πŸ‘· #12276 Access the XRef/Catalog data correctly in the "GetStats"/"GetPageIndex" handlers in src/core/worker.js
    #12271 Improve AcroForm/XFA form type detection
    #12285 Ensure that the sourceEventType parameter is actually optional in PDFViewerApplication.{download, save} (PR 12248 follow-up)
    #12286 Use a link, rather than window.open, when opening PDF attachments in Firefox (bug 1661259)
    #12293 Download, rather than opening, PDF attachments in Firefox (bug 1661259, PR 12286 follow-up)
    #12287 Bug 1661226 - Push button are not rendered with renderInteractiveForms enabled
    #12298 Tweak the vertical positions of the findbar and secondaryToolbar (PR 11077 follow-up)
    #12259 Fix handling of symbolic fonts and unicode cmaps.
    #12300 Fix various :hover effects in the findbar (PR 11077 follow-up)
    ⚑️ #12299 Update the indeterminate progressBar to the new design (PR 11077 follow-up)
    πŸ‘ #12170 [api-minor] Add support for toggling of Optional Content in the viewer (issue 12096)
    πŸ’… #12301 Add (basic) support for Stylelint, to allow linting of CSS files
    πŸ”€ #12296 Add support, in Dict.merge, for merging of "sub"-dictionaries
    πŸ–¨ #12310 Add support for /Print and /SaveAs named actions in the viewer (issue 12308)
    πŸ–¨ #12315 print: Make the firefox printing code able to fail and be re-invoked.
    #12321 Ensure that the viewer property, on BaseViewer-instances, is a valid div-element (issue 12320)


Previous changes from v2.5.207

  • πŸš€ This release features performance improvements thanks to improved image caching and JPEG decoding.

    πŸ”„ Changes since v2.4.456:

    πŸš€ #11717 Bump versions in pdfjs.config and update the getting started page of the website for the new release
    🚚 #11719 Remove the unused wideChars property on Font instances
    ⚑️ #11720 Update the eslint-plugin-no-unsanitized package to the latest version
    ⚑️ #11721 Don't let Travis run npm update during setup
    🚚 #11728 Remove unnecessary checks from the PDFDocumentProperties constructor
    πŸ— #11724 Only build the necessary web/ files during the gulp default_preferences task
    🚚 #11723 Remove variable shadowing from the JavaScript files in the src/display/ folder
    #11725 Re-factor PDFViewerApplication.load such that {PDFViewer, PDFThumbnailViewer}.setDocument happens slightly earlier
    🚚 #11734 Remove old API methods which were previously converted to throwing (PR 11219 follow-up)
    #11736 Add passive: false to the wheel event listener used in PDFPresentationMode (issue 11735, PR 10765 follow-up)
    🚚 #11742 Remove variable shadowing from the JavaScript files in the test/unit/ folder
    🚚 #11738 Remove variable shadowing from the JavaScript files in the src/core/ folder
    #11707 Always prefer the PDF.js JPEG decoder for very large images, in order to reduce peak memory usage (issue 11694)
    #11744 The first glyph in CFF CIDFonts must be named 0 instead of ".notdef"
    πŸ–¨ #11646 Ensure that automatic printing still works when the viewer and/or its pages are hidden (bug 1618621, bug 1618955)
    #11747 Add passive: false when removing wheel listeners
    πŸ‘• #11745 Enable the ESLint no-shadow rule
    🚚 #11755 Remove the unused sizes and encoding properties on Font instances
    #11767 Replace the RTL images with CSS transforms of the standard images (issue 11766)
    🚚 #11655 [api-minor] Remove the getGlobalEventBus viewer functionality, and the eventBusDispatchToDOM option/preference (PR 11631 follow-up)
    πŸ— #11771 Fail early, in modern GENERIC builds, if certain required browser functionality is missing (issue 11762)
    ⚑️ #11772 Update packages and translations
    #11769 Ensure that Font.charToGlyph won't fail because String.fromCodePoint is given an invalid code point (issue 11768)
    ⚑️ #11781 Update the "gulp jsdoc" task to account for API changes in the mkdirp package (PR 11772 follow-up)
    πŸ“‡ #11780 Move the initialization of "page labels"/"metadata"/"auto print" out of PDFViewerApplication.load
    #11773 [api-minor] Change Font.exportData to use an explicit white-list of exportable properties, and stop exporting internal/unused properties
    0️⃣ #11777 [api-minor] Change Font.exportData to, by default, stop exporting properties which are completely unused on the main-thread and/or in the API (PR 11773 follow-up)
    #11746 Create the glyph mapping correctly for composite Type1, i.e. CIDFontType0, fonts (issue 11740)
    #11727 Add a heuristic to scale even single-char text, when the horizontal/vertical scaling differs significantly (issue 11713)
    0️⃣ #11789 Add a new pdfjs.enablePermissions preference, off by default, to allow the PDF documents to disable copying in the viewer (bug 792816)
    #11797 Don't bundle the fallback grab/grabbing cursor images when running gulp mozcentral
    πŸ— #11799 Fail early, in modern GENERIC builds, if certain required browser functionality is missing (PR 11771 follow-up)
    🚚 #11800 Remove any mention of Gitpod from the README (issue 11732)
    ⚑️ #11809 Update Prettier to version 2.0
    #11806 [api-minor] Fix the return value of PDFDocumentProxy.getViewerPreferences when no viewer preferences are present (PR 10738 follow-up)
    #11810 A couple of small String.fromCodePoint improvements (PR 11698 and 11769 follow-up)
    #11805 Always skip over any additional, unexpected, RSTx (restart) markers in corrupt JPEG images (issue 11794)
    πŸ’» #11813 Suppress browser autofill on page number
    πŸ“„ #11821 docs: Fix simple typo, occurences -> occurrences
    🚚 #11819 [src/core/jpg.js] Remove redundant marker validation at the end of the decodeScan function (PR 11805 follow-up)
    πŸ‘• #11818 Enable the dot-notation ESLint rule
    πŸ‘ #11814 Support the vertical writing mode with SVG backend.
    ⚑️ #11822 Update packages and translations
    πŸ— #11826 Change the "download" keyboard shortcut (Ctrl+S) handling, in GENERIC/CHROME builds, to utilize the EventBus (issue 11657); add a new "openfile" keyboard shortcut (Ctrl+O), in GENERIC builds
    #11823 [src/core/fonts.js] Improve the validateOS2Table function and other code
    πŸ— #11825 Avoid reading the "disablePreferences"/"locale" options, when initializing the viewer, in extension builds
    πŸš€ #11831 Use Node LTS releases to fix Travis CI builds (issue 10790)
    #11835 [api-minor] Change PageViewport to throw when the rotation is not a multiple of 90 degrees
    #11837 Always attempt to dispatch the "webviewerloaded" event at the embedding document (PR 10318 follow-up, issue 11829)
    πŸš€ #11844 [api-minor] Immediately release the font.data property once the font been attached to the DOM (PR 11777 follow-up)
    🌐 #11845 Use the native URL.createObjectURL method more in the web/ folder
    🚚 #11847 Move the maybeValidDimensions check, used with JPEG images, to occur earlier (PR 11523 follow-up)
    βœ… #11807 Introduce Puppeteer for handling browsers during tests
    #11853 Include the name for interactive form elements
    🌐 #11834 Preserve error types during translation
    🚚 #11864 Remove the create-react-app example (issue 11729)
    ⚑️ #11868 Update packages and translations
    #11869 Various smaller clean-up in gulpfile.js
    πŸ‘ #11863 Add more categories of unsupported features.
    πŸ“œ #11872 Gracefully handle annotation parsing errors in Page.getOperatorList (issue 11871)
    πŸ‘• #11879 Enable the ESLint grouped-accessor-pairs rule
    πŸ‘• #11873 Use the ESLint no-restricted-syntax rule to ensure that assert is always called with two arguments
    #11880 Attempt to respect the "zoom" hash parameter, even when the "nameddest" parameter is present (issue 11875)
    πŸ“œ #11889 Handle errors individually for each annotation in the _parsedAnnotations getter
    ⚑️ #11890 Update ESLint to version 7
    #11892 Add a minified-es5 gulp task (issue 11858)
    #11905 Reduce the usage of require statements in code-paths not protected by pre-processor and/or run-time checks
    ⚑️ #11910 Update packages and translations
    🚚 #11911 Remove the SystemJS dependency from the web/preferences.js file
    πŸ’» #11917 [Firefox] Allow PDF attachments to, once again, be opened directly in the browser (bug 1632644)
    πŸ‘· #11914 Convert the src/pdf.js and src/pdf.worker.js files to use standard import/export statements
    #11919 Reduce usage of SystemJS, in the development viewer, even further
    #11912 Attempt to cache repeated images at the document, rather than the page, level (issue 11878)
    πŸ‘· #11924 Avoid hanging the worker-thread for CMap data with ridiculously large ranges (issue 11922)
    🚚 #11926 Allow GlobalImageCache.clear to, optionally, only remove the actual data (PR 11912 follow-up)
    #11601 [api-minor] Decode all JPEG images with the built-in PDF.js decoder in src/core/jpg.js
    #11927 Implement fill opacity for shading patterns in the SVG back-end
    ⚑️ #11939 Update Acorn to version 7
    #11940 Add comments to the export list in the src/pdf.js file (PR 11914 follow-up)
    #11930 Improve the local image caching in PartialEvaluator.getOperatorList
    πŸ— #11943 Remove unused code from the external/builder/builder.js file
    ⚑️ #11945 Update packages and translations
    #11947 Ensure that that we don't attempt to cache inline images in the GlobalImageCache (PR 11912 follow-up)