198 Commits

Author SHA1 Message Date
Tim van der Meij
f4326e17c4
Merge pull request #20610 from calixteman/brotli
Add support for Brotli decompression
2026-02-01 20:41:06 +01:00
Jonas Jenwald
839c257f87 Replace the IDownloadManager interface with an abstract BaseDownloadManager class
This should help reduce the maintenance burden of the code, since you no longer need to remember to update separate code when touching the different `DownloadManager` classes.
2026-02-01 17:56:03 +01:00
calixteman
43273fde27
Add support for Brotli decompression
For now, `BrotliDecode` hasn't been specified but it should be in a
close future.
So when it's possible we use the native `DecompressionStream` API
with "brotli" as argument.
If that fails or if we've to decompress in a sync context, we fallback
to `BrotliStream` which a pure js implementation (see README in external/brotli).
2026-01-31 16:25:53 +01:00
Jonas Jenwald
5d02076313 Add tests (and CI) to ensure that preference generation works correctly for all relevant build-targets
Given that previous patches reduced that number of build-targets running this code, ensure that it's still tested sufficiently.
2026-01-30 13:31:13 +01:00
Jonas Jenwald
2a83f955b0 Make getDefaultPreferences a synchronous function, to simplify the build scripts 2026-01-30 13:26:19 +01:00
Jonas Jenwald
06cf7dd7b0 Stop pre-building the preference defaults, to simplify the build scripts
This is a left-over from before the introduction of `AppOptions`, but is no longer necessary now.
2026-01-30 13:26:19 +01:00
Jonas Jenwald
35e78f7f11 Generate the preferences_schema.json file, for the Chromium addon, during building
This avoids the hassle of having to manually update that file when adding/modifying preferences in the viewer.
Updating the preferences-metadata should now only be something that the Chromium addon maintainer has to do.
2026-01-30 13:26:16 +01:00
Jonas Jenwald
663d4cd6e7 Use standard ReadableStreams in the src/display/node_stream.js code
Thanks to newer Node.js functionality, see https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options, we can use standard `ReadableStream`s which help to significantly shorten and simplify the code.

For older Node.js versions we use the `node-readable-to-web-readable-stream` package, see https://www.npmjs.com/package/node-readable-to-web-readable-stream, to get the same functionality.
2026-01-25 12:34:47 +01:00
David Giessing
0aa4fc6af8
fix: Update image pattern in gulpfile to accommodate missing images 2026-01-22 23:01:46 +01:00
Tim van der Meij
cb36cbdc13
Merge pull request #20547 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2026-01-03 23:32:02 +01:00
calixteman
98c1955bd4
Use the PDFium JBig2 decoder compiled into wasm
The decoder is ~4x faster than the JS decoder on large images.
2026-01-03 22:05:14 +01:00
Tim van der Meij
2838e161b8
Update dependencies to the most recent versions 2026-01-03 20:38:22 +01:00
Tim van der Meij
c5db38dd86
Update dependencies to the most recent versions 2025-12-22 16:26:37 +01:00
calixteman
2367196a00
Change the sidebar for a views manager
Update the styles and HTML to reflect the new views manager concept.
For now, nothing about split/merge functionality is implemented or visible.
The new styles for the outline, attachments, and layers will be added later.

The thumbnail view is now accessible with the keyboard.
2025-12-15 17:43:52 +01:00
Calixte Denizet
4bf759404c
Add a new linting task in order to detect unused/unknown css variables in the Firefox build
The goal is to be able to catch the errors before making a release.
And fix some css issues (especially the missing css code for the newly added menu.css)
2025-12-08 09:44:33 +01:00
Tim van der Meij
758856e664
Update dependencies to the most recent versions
Note that the `prettier` update requires a small bit of reformatting in
the Gulpfile so that linting keeps passing.
2025-11-29 18:52:33 +01:00
Calixte Denizet
b9368b576d Lint and format the HTML in using Prettier
The linter found some issues in viewer.html with </input> which isn't required
and a missing closing div in test/resources/reftest-analyzer.html.
The HTML can now be nicely formatted. In order to not break the build for
mozilla-central, the preprocessor has been fixed in order to take into account
the white spaces at the beginning of a comment line.
And finally, make .prettierrc (which is supposed to be either json or yaml)
itself lintable.
2025-11-18 17:22:50 +01:00
Tim van der Meij
cbd2b3d426
Update dependencies to the most recent versions 2025-10-26 16:40:07 +01:00
Tim van der Meij
6bd5c7cdb3
Update dependencies to the most recent versions 2025-10-14 20:26:50 +02:00
Tim van der Meij
a730cba414
Update dependencies to the most recent versions 2025-09-14 19:23:34 +02:00
Tim van der Meij
4dcfc96703
Update dependencies to the most recent versions 2025-08-30 18:38:25 +02:00
Tim van der Meij
d49fc494cd
Update dependencies to the most recent versions 2025-08-17 16:32:29 +02:00
Calixte Denizet
605c9be94f Add comment-* images when building components
It fixes #20127.
2025-07-28 14:30:03 +02:00
Tim van der Meij
5d6023cb2a
Update dependencies to the most recent versions 2025-07-19 18:39:16 +02:00
Tim van der Meij
7a129f8eae
Update dependencies to the most recent versions 2025-07-12 20:20:05 +02:00
Tim van der Meij
7f619c7605
Update dependencies to the most recent versions 2025-06-22 15:24:53 +02:00
Jonas Jenwald
d81174d7bc
Merge pull request #19956 from Snuffleupagus/versionInfoHeader
Improve how the PDF.js version/commit information is exposed in the *built* files
2025-05-22 15:24:02 +02:00
calixteman
32789073a9
Revert "Minify the js code when building for Firefox (bug 1965003)" 2025-05-22 14:08:31 +02:00
Jonas Jenwald
97a42486f5 Improve how the PDF.js version/commit information is exposed in the *built* files
To make it easier to tell which PDF.js version/commit that the *built* files correspond to, they have (since many years) included `pdfjsVersion` and `pdfjsBuild` constants with that information.

As currently implemented this has a few shortcomings:
 - It requires manually adding the code, with its preprocessor statements, in all relevant files.

 - It requires ESLint disable statements, since it's obviously unused code.

 - Being unused, this code is removed in the minified builds.

 - This information would be more appropriate as comments, however Babel discards all comments during building.

 - It would be helpful to have this information at the top of the *built* files, however it's being moved during building.

To address all of these issues, we'll instead utilize Webpack to insert the version/commit information as a comment placed just after the license header.
2025-05-19 15:01:05 +02:00
Tim van der Meij
d297e44f3f
Update dependencies to the most recent versions 2025-05-17 15:50:54 +02:00
Jonas Jenwald
13c9995455 Enable the unicorn/prefer-import-meta-properties ESLint plugin rule
Given that we require Node.js versions `>=20.16.0 || >=22.3.0` using this should be fine, based on the "History" data in https://nodejs.org/api/esm.html#importmetadirname respectively https://nodejs.org/api/esm.html#importmetafilename.

Please also see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-import-meta-properties.md
2025-05-16 07:47:08 +02:00
Calixte Denizet
8129ccc9a7 Minify the js code when building for Firefox (bug 1965003)
It helps to improve the loading time in the worker by around 25% on Windows, Mac and Android.
2025-05-15 19:01:52 +02:00
Nicolò Ribaudo
aebe0cb67f
Remove unused OpenJPEG wasm fallback logic
Emscripten generates code that allows the caller to provide the Wasm
module (thorugh Module.instantiateWasm), with a fallback in case
.instantiateWasm is not provided. We always define instantiateWasm, so
we can hard-code the check and let our dead code elimination logic
remove the unused fallback.

This commit also improved the dead code elimination logic so that if
a function declaration becomes unused as a result of removing dead
code, the function itself is removed.
2025-05-13 19:38:17 +02:00
Nicolò Ribaudo
ff432c39f9
Preserve webpack/vite ignore comments when minifying
They were removed in the minified build, but the code that made the comments necessary was still there (just minified). This commit updates the Terser config to preserve them.

The default value of Terser's `comments` option is [`/@preserve|@copyright|@lic|@cc_on|^\**!/i`](d528103b7c/lib/output.js (L178C12-L178C53)), however the only type of comment it was actually matching in our case is `@lic`, for the license header in minified files. Thus the new regexp is `/@lic|webpackIgnore|@vite-ignore/i`.
2025-05-13 12:52:29 +02:00
zhangningning
940b4657fc Tweak the Node.js version listed in "engines", to ensure that process.getBuiltinModule is available 2025-04-24 15:04:15 +08:00
Jonas Jenwald
ae1cbc6a9e Use the light-dark CSS function in the viewer (issue 17780)
This removes the need for (most) separate `@media (prefers-color-scheme: dark)` blocks when defining colors values, and also provides a simple way of forcing use of either the light or dark theme.

Please refer to https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark and https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme

*NOTE:* To support this in older browsers, we utilize a [PostCSS plugin](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function).
2025-04-23 15:31:39 +02:00
Calixte Denizet
75e9f2a0e8 Replace the info icon in the undo bar by the right one (bug 1960523) 2025-04-18 14:13:02 +02:00
Jonas Jenwald
6b961c424f Update Webpack to version 5.99.5 (issue 19808)
In Webpack version `5.99.0` the way that `export` statements are handled was changed slightly, with much less boilerplate code being generated, which unfortunately breaks our `tweakWebpackOutput` function that's used to expose the exported properties globally and that e.g. the viewer depends upon.

Given that we were depending on formatting that should most likely be viewed as nothing more than an internal implementation detail in Webpack, we instead work-around this by manually defining the structures that were previously generated.
Obviously this will lead to a tiny bit more manual work in the future, however we don't change the API-surface often enough that it should be a big issue *and* the relevant unit-tests are updated such that it shouldn't be possible to break this.

*NOTE:* In the future we might want to consider no longer using global properties like this, and instead rely only on proper `export`s throughout the code-base.
However changing this would likely be non-trivial (given edge-cases), and it'd be an `api-major` change, so let's just do the minimal amount of work to unblock Webpack updates for now.
2025-04-13 16:48:19 +02:00
Jonas Jenwald
18617eb792 Tweak the Node.js version listed in "engines", to ensure that process.getBuiltinModule is available
In order to use the PDF.js library in Node.js environments the `process.getBuiltinModule` functionality must be available, which was released in [version `20.16.0`](https://nodejs.org/en/blog/release/v20.16.0), however we've seen repeated issues filed by users on older `20.x` versions.
2025-04-06 14:32:36 +02:00
Tim van der Meij
cfe6cc6a7e
Upgrade @metalsmith/layouts to version 3.0.0
This is a major version bump, and the changelog at
https://github.com/metalsmith/layouts/releases/tag/v3.0.0
indicates a breaking change that impacts us, namely that we need to
explicitly define the pattern and transformer that we wish to use.
2025-03-15 20:42:08 +01:00
Tim van der Meij
ef7e0ddae4
Update dependencies to the most recent versions 2025-03-15 20:42:08 +01:00
Calixte Denizet
7280540901 [api-minor] Use an icc profile for converting CMYK to RGB 2025-03-10 14:18:20 +01:00
Calixte Denizet
971be48b60 Support using ICC profiles in using qcms (bug 860023) 2025-03-05 10:29:59 +01:00
Calixte Denizet
559ff28db3 Use the latest emsdk version to compile openjpeg decoder 2025-03-04 18:41:20 +01:00
Hector Rincon
4069c3a422 Reenable viewerCssTheme option for Firefox
The `viewerCssTheme` was removed in #17222  and subsequently reenabled in #17293,
but only for Chromium and generic builds. This commit reenables the
function using the new method introduced in #17293.
2025-02-25 22:00:32 -08:00
Calixte Denizet
36e4f5c222 Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076) 2025-02-21 19:03:47 +01:00
Tim van der Meij
d2a07dcac6
Update dependencies to the most recent versions
Moreover, fix the linting issues (using `npx gulp lint --fix`) that are
found by the new versions of the linting tools.
2025-02-09 18:58:26 +01:00
Jonas Jenwald
ad1c79e6af [api-minor] Update the minimum supported Google Chrome version to 110
This patch updates the minimum supported browsers as follows:
 - Google Chrome 110, which was released on 2023-02-07; see https://chromereleases.googleblog.com/2023/02/stable-channel-update-for-desktop.html

Note that nowadays we usually try, where feasible and possible, to support browsers that are about two years old. By limiting support to only "recent" browsers we reduce the risk of holding back improvements of the *built-in* Firefox PDF Viewer, and also (significantly) reduce the maintenance/support burden for the PDF.js contributors.

*Please note:* As always, the minimum supported browser version assumes that a `legacy`-build of the PDF.js library is being used; see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
2025-02-09 13:33:55 +01:00
calixteman
08663f715b
Merge pull request #19414 from calixteman/signature_dialog2
[Editor] Add a new dialog for the signature editor (bug 1945574)
2025-02-06 16:20:01 +01:00
Calixte Denizet
fa25ab9c13 [Editor] Add a new dialog for the signature editor (bug 1945574) 2025-02-05 23:00:38 +01:00