Jonas Jenwald
3d4e8bb17e
Add a basic navigator polyfill for older Node.js versions
...
Modern Node.js versions now include a `navigator` implementation, with a few basic properties, that's actually enough for the PDF.js use-cases; please see https://nodejs.org/api/globals.html#navigator
Unfortunately we still support Node.js version `20`, hence we add a basic polyfill since that allows simplifying the code slightly.
2025-04-28 13:07:12 +02:00
Tim van der Meij
b47b248e15
Merge pull request #19875 from timvandermeij/bump
...
Bump the stable version in `pdfjs.config`
2025-04-27 14:53:05 +02:00
Tim van der Meij
6d0e8d752d
Bump the stable version in pdfjs.config
2025-04-27 14:49:27 +02:00
Tim van der Meij
4f7761353c
Merge pull request #19873 from timvandermeij/fix-editor-undo-bar-intermittents
...
Fix the "must work properly when selecting undo by keyboard" integration test
v5.2.133
2025-04-27 14:15:34 +02:00
Tim van der Meij
967e34046a
Fix the "must work properly when selecting undo by keyboard" integration test
...
This integration test fails intermittently because the undo button can
only be activated if focus can be put on it, and that in turn can only
happen if it's visible. The test tried to make sure that the undo bar
is visible, but checking for the absence of the `hidden` attribute is
unfortunately not enough to assert visibility according to Puppeteer
documentation [1]. Moreover, the undo button wasn't checked at all.
To fix the issue we let Puppeteer do the visibility detection for the
undo bar by providing the `visible: true` option to `waitForSelector`
[2]. This is consistent with the other tests that already do this, and
also with the existing code that detects if the undo bar is hidden
(which uses the `hidden: true` option of `waitForSelector`). Moreover,
we wait for the undo button to be present before putting focus on it.
For consistency, and to avoid intermittent failures elsewhere, we mirror
this solution to the other undo bar/button tests of the various editors.
[1] https://pptr.dev/api/puppeteer.elementhandle.isvisible
[2] https://pptr.dev/api/puppeteer.waitforselectoroptions
2025-04-27 14:00:50 +02:00
Tim van der Meij
9e1f93e5eb
Merge pull request #19874 from Snuffleupagus/issue-19871
...
Always render the Annotation- and XFA-layers with light `color-scheme` (issue 19871)
2025-04-27 11:54:08 +02:00
Jonas Jenwald
0852c42c15
Always render the Annotation- and XFA-layers with light color-scheme (issue 19871)
...
The intention with PR 19819 was to change how colours are specified for the viewer UI, however it wasn't intended to affect elements in the Annotation- and XFA-layers.
Hence we enforce the light `color-scheme` for these layers, and also make sure to provide a default `color` for PopupAnnotations.
2025-04-26 20:44:07 +02:00
Tim van der Meij
48b7d9f424
Merge pull request #19869 from timvandermeij/updates
...
Update dependencies and translations to the most recent versions
2025-04-26 18:01:22 +02:00
Tim van der Meij
b8dd236ae6
Update translations to the most recent versions
2025-04-26 15:52:12 +02:00
Tim van der Meij
cbf61712f9
Update dependencies to the most recent versions
2025-04-26 15:51:20 +02:00
Tim van der Meij
a40bf37184
Merge pull request #19866 from Snuffleupagus/updateUrlHash
...
Avoid (most) string parsing when removing/replacing the hash property of a URL
2025-04-26 12:21:38 +02:00
Jonas Jenwald
c2d88540b4
Merge pull request #19868 from Snuffleupagus/MathClamp-4
...
Use the `MathClamp` helper function more in the `web/` folder (PR 19617 follow-up)
2025-04-26 12:07:30 +02:00
Tim van der Meij
6891602e7f
Merge pull request #19858 from luckymore/master
...
Tweak the Node.js version listed in "engines", to ensure that process.getBuiltinModule is available
2025-04-26 11:45:27 +02:00
Tim van der Meij
2fc325e4f8
Merge pull request #19814 from loganrosen/beginner-bug-readme
...
Fix beginner bugs link in README
2025-04-26 11:29:41 +02:00
Jonas Jenwald
af3d13c22d
Use the MathClamp helper function more in the web/ folder (PR 19617 follow-up)
...
There's one more spot that I missed in PR 19617.
2025-04-26 11:09:52 +02:00
Jonas Jenwald
abc9522886
Avoid (most) string parsing when removing/replacing the hash property of a URL
2025-04-25 23:13:05 +02:00
calixteman
efc5c3c231
Merge pull request #19862 from calixteman/bug1961423
...
Fix 'print to pdf' on Mac with a cid font (bug 1961423)
2025-04-25 15:11:55 +02:00
Jonas Jenwald
312c85bfd6
Merge pull request #19815 from Snuffleupagus/getMergedResources-size
...
Ensure that "local" /Contents stream-dict /Resources aren't empty (PR 19803 follow-up)
2025-04-25 10:46:04 +02:00
Jonas Jenwald
1a5c9e90dd
Merge pull request #19861 from Snuffleupagus/debugger-fix-light-dark-fallout
...
Fix the debugger CSS when using the dark theme (PR 19819 follow-up)
2025-04-25 10:44:55 +02:00
Jesper
8af06a4c60
Add useractivation check for response function
2025-04-24 22:40:28 +02:00
Calixte Denizet
785991a97c
Fix 'print to pdf' on Mac with a cid font (bug 1961423)
2025-04-24 20:19:12 +02:00
Jonas Jenwald
6b76bdac3a
Fix the debugger CSS when using the dark theme (PR 19819 follow-up)
...
Perhaps we should update the debugger CSS to properly account for the light/dark theme, however since that's not UI that end-users ever see we simply force using the light theme for now.
2025-04-24 17:34:29 +02:00
calixteman
91175dc67d
Merge pull request #19854 from calixteman/fix_find_in_tests
...
Fix errors when running the integration tests
2025-04-24 11:27:03 +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
Calixte Denizet
8630822a63
Fix errors when running the integration tests
...
JavaScript error: http://127.0.0.1:42301/build/generic/web/viewer.mjs , line 5822: TypeError: this[#state] is null
JavaScript error: http://127.0.0.1:42301/build/generic/web/viewer.mjs , line 6001: TypeError: can't access property "getPage", this._pdfDocument is null
2025-04-23 23:04:24 +02:00
Jonas Jenwald
de2a44a558
Merge pull request #19849 from Snuffleupagus/issue-19848
...
Ensure that the /Form XObject /Resources-entry is actually a dictionary (issue 19848)
2025-04-23 16:48:06 +02:00
Jonas Jenwald
01c1c6e60f
Merge pull request #19819 from Snuffleupagus/CSS-light-dark
...
Use the `light-dark` CSS function in the viewer (issue 17780)
2025-04-23 16:30:03 +02:00
calixteman
627a935baf
Merge pull request #19853 from calixteman/issue19850
...
Disable userActivation before executing a setTimeout/setInterval callback
2025-04-23 16:11:59 +02: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
05a45346a5
Disable userActivation before executing a setTimeout/setInterval callback
...
Fixes issue #19850 .
2025-04-23 15:25:12 +02:00
Jonas Jenwald
64007e777e
Ensure that the /Form XObject /Resources-entry is actually a dictionary (issue 19848)
2025-04-23 10:19:20 +02:00
Jonas Jenwald
63e6566597
Merge pull request #19816 from Snuffleupagus/bug-1957401
...
Add a "supportsPrinting" viewer-option (bug 1957401)
2025-04-22 15:25:20 +02:00
Jonas Jenwald
213d51d7e9
Merge pull request #19823 from Snuffleupagus/rm-duplicate-secondaryToolbar-mask-image
...
Remove duplicate secondaryToolbar button `mask-image` definitions (PR 18385 follow-up)
2025-04-22 15:14:47 +02:00
Jonas Jenwald
c8ed291cf9
Merge pull request #19836 from Snuffleupagus/issue-19835
...
Always fallback to checking all destinations, when lookup fails (issue 19835)
2025-04-22 15:14:05 +02:00
Jonas Jenwald
c63c51e016
Merge pull request #19841 from Snuffleupagus/issue-19840
...
Fix printing of XFA documents, by calling `XfaLayerBuilder.prototype.render` correctly (issue 19840)
2025-04-22 15:12:46 +02:00
Jonas Jenwald
b4626a77a2
Fix printing of XFA documents, by calling XfaLayerBuilder.prototype.render correctly (issue 19840)
...
When changing the format of various `render`-methods in PR 19365 I forgot to update the code used to print XFA documents, sorry about that.
2025-04-22 09:15:52 +02:00
Jonas Jenwald
adc9eb5a5a
Always fallback to checking all destinations, when lookup fails (issue 19835)
...
In the referenced PDF document the keys, in the /Dests dictionary, need to account for PDFDocEncoding.
To improve destination handling in general we'll now unconditionally fallback to always checking all destinations.
2025-04-20 14:53:10 +02:00
calixteman
d8d3e0abf5
Merge pull request #19829 from calixteman/info_icon
...
Replace the info icon in the undo bar by the right one (bug 1960523)
2025-04-18 14:16:56 +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
87a143dbbc
Merge pull request #19828 from Snuffleupagus/worker-check-Object-prototype
...
Check that the `Object.prototype` hasn't been incorrectly extended (PR 11582 follow-up)
2025-04-18 13:59:07 +02:00
Jonas Jenwald
91ba147317
Check that the Object.prototype hasn't been incorrectly extended (PR 11582 follow-up)
...
This complements, and extends, the existing check of the `Array.prototype` in the worker-thread.
To simplify the implementation we'll now abort immediately, rather than collecting all "bad" properties.
2025-04-18 12:19:29 +02:00
calixteman
4b1875c8c0
Merge pull request #19825 from calixteman/bug1961107
...
Avoid to create any subarrays when optimizing 'save, transform, constructPath, restore' (bug 1961107)
2025-04-17 19:42:28 +02:00
Calixte Denizet
d7cbda6cb5
Avoid to create any subarrays when optimizing 'save, transform, constructPath, restore' (bug 1961107)
...
Removing those `subarray`calls helps to improve performance by a factor 6 on Linux and by a factor of 3
on Windows 11.
2025-04-17 19:14:01 +02:00
Jonas Jenwald
f1e20cd668
Merge pull request #19824 from Snuffleupagus/getStructTree-catch-errors
...
Improve error handling when parsing page-structTrees
2025-04-17 15:21:55 +02:00
Jonas Jenwald
bf553f22da
Ensure that the /P-entry is actually a dictionary in StructTreePage.prototype.addNode
...
This may fix issue 19822, but without a test-case it's simply impossible to know for sure.
2025-04-17 14:01:53 +02:00
Jonas Jenwald
76f23ce3b5
Catch, and ignore, errors during Page.prototype.getStructTree
...
This way any errors thrown during parsing of the page-structTree will not be forwarded to the viewer.
2025-04-17 13:57:30 +02:00
Jonas Jenwald
8e7060158e
Remove duplicate secondaryToolbar button mask-image definitions (PR 18385 follow-up)
...
It appears that all secondaryToolbar buttons currently have their `mask-image` definitions duplicated, which leads to larger than necessary CSS files.
2025-04-17 10:51:51 +02:00
Jonas Jenwald
97fe7d6a19
Add a "supportsPrinting" viewer-option (bug 1957401)
...
This will allow us to respect the `print.enabled` Firefox preference, by extending [this method](https://searchfox.org/mozilla-central/rev/56117379696ea0cffb94cd09c14cd022a8c5e4e8/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#426-453 ), which will hide the toolbar and secondaryToolbar print-buttons.
2025-04-15 12:43:11 +02:00
Jonas Jenwald
245d9ba925
Ensure that "local" /Contents stream-dict /Resources aren't empty (PR 19803 follow-up)
...
This is a small, and quite possibly pointless, optimization which ensures that any "local" /Resources aren't empty, to avoid needlessly trying to load and merge dictionaries.
2025-04-14 09:58:15 +02:00
Logan Rosen
ba7c34ff56
Fix beginner bugs link in README
2025-04-13 18:57:56 -04:00