pdf.js/web
Jonas Jenwald d8e0794650 Improve the image quality of thumbnails rendered by PDFThumbnailView.draw (issue 8233)
The reason for the fairly large discrepancy, in the thumbnail quality, between the `draw`/`setImage`-methods is that in the former case we *directly* render the thumbnails at the final size that they'll appear at in the sidebar. In the latter case, we instead downsize the (generally) much larger "regular" pages.

To address this, I'm thus proposing that we let `PDFThumbnailView.draw` render thumbnails at *twice* their intended size and then downsize them to the final size.
Obviously this will increase *peak* memory usage during thumbnail rendering in `PDFThumbnailView.draw`, since doubling the width/height of a `canvas` will lead to its pixel-count increasing by a factor of `4`. Furthermore, since you need four components per pixel (given that it's RGBA-data), this will thus lead to the *temporary* thumbnail `canvas`-sizes increasing by a factor of `16` during rendering. Hence why rendering thumbnails at their "original" scale, i.e. using something like `PDFPageProxy.getViewport({ scale: 1 });`, would be an absolutely terrible idea!

To reduce the size and scope of these changes, I've tried to re-factor and re-use as much of the existing downsizing-implementation already present in `PDFThumbnailView` as possible.

While this will generally *not* make thumbnails rendered by `PDFThumbnailView.draw` look *identical* to those based on the rendered pages (via `PDFThumbnailView.setImage`), it's a considerable improvement as far as I'm concerned and enough to call the issue fixed.

*Please note:* This patch will not lead to *any* additional overhead, in either memory usage or parsing, for thumbnails which are based on the rendered pages.
2021-04-08 13:58:24 +02:00
..
images Add an icon for the "find/highlight the current outlineItem" functionality 2021-01-09 16:09:46 +01:00
.eslintrc Enable the ESLint no-var rule globally 2021-03-13 16:12:53 +01:00
.gitignore Remove obselete file from .gitignore 2015-01-26 16:44:45 +01:00
annotation_layer_builder.css Correctly align annotation content in horizontal/spread scrolling modes 2021-01-10 18:58:13 +01:00
annotation_layer_builder.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
app_options.js Fix an edge-case related to compatibility-values in various AppOptions-methods 2021-03-20 13:12:09 +01:00
app.js Merge pull request #13172 from Snuffleupagus/cleanup-keepFonts 2021-04-05 14:21:34 +02:00
base_tree_viewer.js Add support for finding/highlighting the outlineItem, corresponding to the currently visible page, in the sidebar (issue 7557, bug 1253820, bug 1499050) 2021-01-09 16:09:44 +01:00
base_viewer.js Move rotation normalization from PDFViewerApplication and into BaseViewer 2021-03-28 14:19:58 +02:00
chrome-i18n-allow-access-to-file-urls.json Add translations of "Allow access to file URLs" 2015-08-14 18:59:55 +02:00
chromecom.js Split PDFViewerApplication.error into two methods, for PDF document loading/parsing errors vs other errors (PR 11647 follow-up) 2021-02-07 22:28:53 +01:00
compressed.tracemonkey-pldi-09.pdf Add Makefile. Move some files around to make building the website easier. 2011-07-05 10:53:57 -07:00
debugger.js Use DOM hidden property instead of attribute methods 2021-02-08 00:21:49 +01:00
download_manager.js [api-minor] Support the Content-Disposition filename in the Firefox PDF Viewer (bug 1694556, PR 9379 follow-up) 2021-02-26 10:50:29 +01:00
firefox_print_service.js print: Improve rendering of oversized pages. 2021-03-26 16:07:49 +01:00
firefoxcom.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
generic_scripting.js Move the getPdfFilenameFromUrl helper function from web/ui_utils.js and into src/display/display_utils.js 2021-03-17 15:48:24 +01:00
genericcom.js Pass in the "sandboxBundleSrc" option when calling DefaultExternalServices.createScripting 2020-12-23 14:05:49 +01:00
genericl10n.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
grab_to_pan.js [GrabToPan] Use Element.matches() rather than prefixed ...matchesSelector versions 2021-03-26 21:37:51 +01:00
interfaces.js XFA - Add a layer to display XFA forms (#13069) 2021-03-19 10:11:40 +01:00
l10n_utils.js Add landmark region and aria-label for each page. 2021-03-19 14:13:51 -07:00
overlay_manager.js Fix the linting errors, from the Prettier auto-formatting, that ESLint --fix couldn't handle 2019-12-26 12:35:12 +01:00
password_prompt.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
pdf_attachment_viewer.js [api-minor] Support the Content-Disposition filename in the Firefox PDF Viewer (bug 1694556, PR 9379 follow-up) 2021-02-26 10:50:29 +01:00
pdf_cursor_tools.js Remove the useless PresentationModeState.CHANGING-case in PDFCursorTools (PR 12788 follow-up) 2021-02-14 10:39:49 +01:00
pdf_document_properties.js Move the getPdfFilenameFromUrl helper function from web/ui_utils.js and into src/display/display_utils.js 2021-03-17 15:48:24 +01:00
pdf_find_bar.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
pdf_find_controller.js Convert the pendingFindMatches member, in web/pdf_find_controller.js, from an object to a set 2021-04-05 19:33:53 +02:00
pdf_find_utils.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
pdf_history.js [PDFHistory] Correctly simulate an internal destination in the pushPage-method (PR 12493 follow-up) 2021-03-25 12:24:28 +01:00
pdf_layer_viewer.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
pdf_link_service.js Remove the deprecated PDFLinkService.navigateTo-method (PR 12440 follow-up) 2021-04-06 13:08:50 +02:00
pdf_outline_viewer.js Prevent errors, in PDFOutlineViewer._getPageNumberToDestHash, for invalid destRef values (PR 12777 follow-up) 2021-03-28 17:36:51 +02:00
pdf_page_view.js Merge pull request #13118 from brendandahl/page-aria 2021-03-19 23:17:55 +01:00
pdf_presentation_mode.js Remove the deprecated properties from the "presentationmodechanged" event (PR 12788 follow-up) 2021-04-06 13:04:23 +02:00
pdf_print_service.js print: Improve rendering of oversized pages. 2021-03-26 16:07:49 +01:00
pdf_rendering_queue.js Use ESLint to ensure that exports are sorted alphabetically 2021-01-09 20:37:51 +01:00
pdf_scripting_manager.js JS - Handle correctly hierarchy of fields (#13133) 2021-03-30 08:50:35 -07:00
pdf_sidebar_resizer.js Use more optional chaining in the web/-folder (PR 12961 follow-up) 2021-03-07 16:20:52 +01:00
pdf_sidebar.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
pdf_single_page_viewer.js Add previous/next-page functionality that takes scroll/spread-modes into account (issue 11946) 2021-01-22 21:38:15 +01:00
pdf_thumbnail_view.js Improve the image quality of thumbnails rendered by PDFThumbnailView.draw (issue 8233) 2021-04-08 13:58:24 +02:00
pdf_thumbnail_viewer.js Remove the NullL10n default value from viewer components not included in the COMPONENTS-bundle 2021-02-25 16:08:04 +01:00
pdf_viewer.component.js [api-minor] Move the viewer scripting initialization/handling into a new PDFScriptingManager class 2021-03-05 20:31:48 +01:00
pdf_viewer.css XFA - Add a layer to display XFA forms (#13069) 2021-03-19 10:11:40 +01:00
pdf_viewer.js Add previous/next-page functionality that takes scroll/spread-modes into account (issue 11946) 2021-01-22 21:38:15 +01:00
pdfjs.js Enable auto-formatting of the entire code-base using Prettier (issue 11444) 2019-12-26 12:34:24 +01:00
preferences.js Remove some *indirect* loops in the BasePreferences.getAll-method 2021-03-22 14:38:05 +01:00
secondary_toolbar.js fix(a11y): resolve sidebar, find, toolbar missing aria-expanded and 2021-02-05 16:08:29 -08:00
text_layer_builder.css Enable the Stylelint length-zero-no-unit rule 2021-01-10 14:09:36 +01:00
text_layer_builder.js Use optional chaining, where possible, in the web/-folder 2021-02-05 17:50:11 +01:00
toolbar.js Collect all l10n fallback strings, used in the viewer, in one helper function (PR 12981 follow-up) 2021-03-04 11:34:51 +01:00
ui_utils.js Tweak the pre-processor condition, for Node.js environments, in the animationStarted helper (issue 13057) 2021-03-20 13:34:38 +01:00
view_history.js Add a bit more validation in the ViewHistory constructor 2020-03-21 13:55:06 +01:00
viewer_compatibility.js Remove code-paths only relevant for IE 11/Edge (non-Chromium based) from the web/ folder 2020-09-05 17:18:15 +02:00
viewer-snippet-chrome-extension.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer-snippet-chrome-overlays.html [CRX] Add file chooser as fallback (fixes #9411) 2018-03-21 18:21:46 +01:00
viewer-snippet-firefox-extension.html Stop bundling the ReadableStream polyfill in MOZCENTRAL builds (PR 10470 follow-up) 2019-01-23 20:33:20 +01:00
viewer-snippet-minified.html Remove XHTML leftovers from the viewer HTML files 2016-02-14 13:23:34 +01:00
viewer-snippet.html Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
viewer.css print: Improve rendering of oversized pages. 2021-03-26 16:07:49 +01:00
viewer.html Stop including the "errorWrapper" HTML code in MOZCENTRAL-builds 2021-02-14 10:39:34 +01:00
viewer.js Stop including the "errorWrapper" HTML code in MOZCENTRAL-builds 2021-02-14 10:39:34 +01:00
xfa_layer_builder.css XFA - Add support for few ui elements (#13115) 2021-03-31 15:42:21 +02:00
xfa_layer_builder.js XFA - Convert some template properties into CSS ones (#13082) 2021-03-25 13:02:39 +01:00