181 Commits

Author SHA1 Message Date
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
Jonas Jenwald
696c6c626b Include the OpenJPEG license files
This is consistent with the handling of CMaps and StandardFontData.
2025-02-04 10:39:38 +01:00
Jonas Jenwald
de79996574 Bundle wasm-files in pdfjs-dist (PR 19329 follow-up) 2025-02-04 10:22:26 +01:00
Tim van der Meij
09a0a0f06f
Merge pull request #19358 from Snuffleupagus/Node-enable-web_pdfjsLib
Enable the "checks that the viewer re-exports the expected API functionality" unit-test in Node.js
2025-01-26 16:45:51 +01:00
Jonas Jenwald
0790d94674 Enable the "checks that the viewer re-exports the expected API functionality" unit-test in Node.js
By also running `gulp generic-legacy` before the Node.js unit-tests, we can enable one more test-case in Node.js environments.
2025-01-20 22:10:36 +01:00
Jonas Jenwald
0053b36ee7 Support multiple wasm-files in the development viewer
This prepares for a future where we're using more than one wasm-file, originating in different `external/`-folders, by extending the existing `gulp.watch` usage.
The following diff illustrates how to add more entries:

```diff
diff --git a/gulpfile.mjs b/gulpfile.mjs
index 0e0a5a1ac..1502755be 100644
--- a/gulpfile.mjs
+++ b/gulpfile.mjs
@@ -655,6 +655,10 @@ function createWasmBundle() {
       base: "external/openjpeg",
       encoding: false,
     }),
+    gulp.src(["external/foobar/*.wasm"], {
+      base: "external/foobar",
+      encoding: false,
+    }),
   ]);
 }

@@ -2125,7 +2129,7 @@ gulp.task(
     },
     function watchWasm() {
       gulp.watch(
-        "external/openjpeg/*",
+        ["external/openjpeg/*", "external/foobar/*"],
         { ignoreInitial: false },
         gulp.series("dev-wasm")
       );
```
2025-01-18 09:35:11 +01:00
Calixte Denizet
94b4b54ef6 [api-major] Add openjpeg.wasm to pdf.js (bug 1935076)
In order to fix bug 1935076, we'll have to add a pure js fallback in case wasm is disabled
or simd isn't supported. Unfortunately, this fallback will take some space.

So, the main goal of this patch is to reduce the overall size (by ~93k).
As a side effect, it should make easier to use an other wasm file (which must export
_jp2_decode, _malloc and _free).
2025-01-16 21:09:50 +01:00
Tim van der Meij
45d2e808fd
Update dependencies to the most recent versions 2025-01-09 22:48:00 +01:00
Tim van der Meij
7d1ca73acc
Update dependencies to the most recent versions 2024-12-07 13:22:44 +01:00
Tim van der Meij
a4eb8407c1
Merge pull request #19149 from Snuffleupagus/issue-19145
Prevent Webpack from resolving `import.meta.url` statements during building (issue 19145)
2024-12-05 21:38:26 +01:00
Ujjwal Sharma
dd82d78a2d Pop open a message when user deletes an annotation
When a user deletes any number of annotations, they are notified of the action
by a popup message with an undo button. Besides that, this change reuses the
existing messageBar CSS class from the new alt-text dialog as much as possible.
2024-12-03 11:03:15 +01:00
Jonas Jenwald
a2b889bb9a Prevent Webpack from resolving import.meta.url statements during building (issue 19145)
This fixes a Node.js-specific regression from PR 18959.
2024-12-02 13:38:22 +01:00
Jonas Jenwald
867aaf01fa
Merge pull request #19117 from Snuffleupagus/bot-forceNoChrome
Disable the browser-tests in Google Chrome on the bots
2024-12-01 18:28:03 +01:00
Tim van der Meij
7784f868fc
Update dependencies to the most recent versions 2024-12-01 14:49:03 +01:00
Jonas Jenwald
fd31e728f7 Disable the browser-tests in Google Chrome on the bots
Given that `browsertest` repeatedly timeout in Google Chrome, and considering that Firefox is the primary development target, we stop running them on the bots to avoid having to repeatedly deal with this.

Note that we already disabled these tests *on Windows* almost three years ago, because of stability issues; see PR 14392.
2024-11-27 17:59:51 +01:00
Nicolò Ribaudo
a8592d86a9
Use JSON imports instead of PDFJSDev.json
JSON imports are now supported by all tools used in PDF.js' build
process. The `chromecom.js` file is bundled by webpack and
import attributes are thus removed, so browser compatibility for this
new syntax is not relevant.
2024-11-18 16:21:12 +01:00
Calixte Denizet
1c5d93cf2d Update svglint to 3.1.0
The new release contains:
 - https://github.com/simple-icons/svglint/pull/110
 - https://github.com/simple-icons/svglint/pull/111

which allow us to slightly simplify our code.
2024-11-18 15:00:07 +01:00
Tim van der Meij
50d79736f5
Update dependencies to the most recent versions 2024-11-17 19:55:28 +01:00