Commit Graph

16939 Commits

Author SHA1 Message Date
Tim van der Meij
351d11c9bd
Merge pull request #16147 from Snuffleupagus/update-packages
Update packages and translations
2023-03-12 13:29:51 +01:00
Jonas Jenwald
c6c9eb4ccb Update l10n files 2023-03-12 10:40:53 +01:00
Jonas Jenwald
1d06523366 Update npm packages 2023-03-12 10:36:00 +01:00
Tim van der Meij
9819f1cc6b
Merge pull request #16108 from Snuffleupagus/delay-cleanup
Slightly delay cleanup, after rendering, in documents with large images
2023-03-11 15:52:12 +01:00
Tim van der Meij
05f29c8720
Merge pull request #16141 from Snuffleupagus/FilterFactory-docId
Include the document-id in the SVG-filter names (PR 16062 follow-up)
2023-03-11 15:45:42 +01:00
Tim van der Meij
1234d207e9
Merge pull request #16142 from Snuffleupagus/issue-16134
Fix the JSDoc `returns`-type for two `PageViewport`-methods (issue 16134)
2023-03-11 14:53:21 +01:00
Tim van der Meij
cc499505df
Merge pull request #16123 from Snuffleupagus/Node-16
[api-minor] Update the minimum supported Node.js version to 16
2023-03-11 14:49:59 +01:00
calixteman
b2a86350fc
Merge pull request #16096 from bungeman/fix_trig_functions
Correct PostScript trigonometric operators
2023-03-11 14:32:23 +01:00
calixteman
4a4c5d0fe2
Merge pull request #16145 from calixteman/issue16135
Move the svg definitions in its own div
2023-03-10 17:45:29 +01:00
Calixte Denizet
f9539e57ef Move the svg definitions in its own div
This way the svg element doesn't take up space in the viewer.
Fixes issue #16135.
2023-03-10 17:03:40 +01:00
calixteman
0338df2f6d
Merge pull request #16138 from calixteman/bug1820909
Fix search in pdf a containing some UTF-32 characters (bug 1820909)
2023-03-09 19:15:49 +01:00
Jonas Jenwald
9232264b8a Fix the JSDoc returns-type for two PageViewport-methods (issue 16134)
The affected methods have always returned Arrays, however the JSDoc did not accurately reflect that.
2023-03-09 15:57:16 +01:00
Jonas Jenwald
92296fa6a1 Include the document-id in the SVG-filter names (PR 16062 follow-up)
In the general PDF.js library multiple PDF documents may be opened on the same web-page, which is why we many years ago started using document-specific identifiers to prevent issues with global data such e.g. with fonts.
Hence we need to treat the identifiers generated by the `FilterFactory` in the same way, since the SVG-filters for two separate PDF documents may otherwise get identical ids.
2023-03-09 15:35:29 +01:00
Calixte Denizet
07b094729e Fix search in pdf a containing some UTF-32 characters (bug 1820909)
Some chars were supposed to have a length equals to 1 but UTF-32 chars
can be longuer.
2023-03-09 15:03:01 +01:00
Jonas Jenwald
c0671ac133 Slightly increase the maximum image sizes that we'll cache
The current value originated in PR 2317, and in the decade that have passed the amount of RAM available in (most) devices should have increased a fair bit.
Nowadays we also do a much better job of detecting repeated images at both the page- and document-level, which helps reduce overall memory-usage in many documents.

Finally the constant is also moved into the `src/shared/util.js` file, since it was implicitly used on both the main- and worker-thread previously.
2023-03-08 17:06:10 +01:00
Jonas Jenwald
15d9faba57 Slightly delay cleanup, after rendering, in documents with large images
Currently in PDF documents with large images we immediately cleanup once rendering has finished, in order to reduce memory-usage.
Normally that shouldn't be a big problem, however when e.g. repeated zooming happens in the viewer that could easily lead to a lot of wasted resources (and waiting).

Hence this patch, which introduces a new `PDFPageProxy` method that will slightly delay cleanup after rendering.
2023-03-08 17:06:09 +01:00
Jonas Jenwald
e7a7f02f4c Convert a couple of fields/methods into properly private ones in PDFPageProxy
These were always intended to be *private*, so let's use modern JS features to actually enforce that.
2023-03-08 17:06:09 +01:00
calixteman
a0ef5a4ae1
Merge pull request #16115 from calixteman/issue16114
Apply transfer filters to any graphic commands
2023-03-08 14:53:41 +01:00
calixteman
32e2f7c8e5
Merge pull request #16131 from calixteman/issue16049
Partially revert PR 15578
2023-03-08 12:57:18 +01:00
Jonas Jenwald
6839f15a32
Merge pull request #16128 from Snuffleupagus/issue-16127
Support (rare) Type3 fonts with Pattern resources (issue 16127)
2023-03-08 12:21:53 +01:00
Jonas Jenwald
e5427ab11b
Merge pull request #16122 from Snuffleupagus/rm-onUnsupportedFeature
[api-minor] Remove the deprecated `onUnsupportedFeature` functionality (PR 15758 follow-up)
2023-03-08 12:16:27 +01:00
Calixte Denizet
dabfbc623e Partially revert PR 15578
The dimensions still need to be fixed (from times to times they're in px)
but it doesn't have to be postponed anymore.
To test it: draw something and when resizing look at the dimensions of the div
in devtools, the units must be %.
2023-03-08 12:10:27 +01:00
calixteman
cc555a389b
Merge pull request #16117 from calixteman/workaround_bug1820511
Avoid to have a factor too close to 2 when downscaling image
2023-03-08 11:12:56 +01:00
Calixte Denizet
1617ee6c3f Avoid to have a factor too close to 2 when downscaling image
It's a workaround for bug 1820511: it only affects Firefox on Windows
using the D2D backend.
2023-03-08 11:05:46 +01:00
calixteman
39ff039b8a
Merge pull request #16125 from calixteman/firefox_max_area
[api-minor] Add an option to set the max canvas area
2023-03-08 10:56:03 +01:00
Calixte Denizet
e9474f1c84 [api-minor] Add an option to set the max canvas area 2023-03-08 10:37:06 +01:00
Jonas Jenwald
471aef5fc6 Support (rare) Type3 fonts with Pattern resources (issue 16127)
This simply extends the approach in PR 10727 to also cover Patterns, which shouldn't be a common occurrence in Type3 fonts (since this is the first issue we've seen).
2023-03-08 09:20:52 +01:00
Calixte Denizet
8304df2520 Apply transfer filters to any graphic commands 2023-03-07 22:17:19 +01:00
calixteman
e0d934ac9d
Merge pull request #16124 from calixteman/issue16119
Slightly modify the max width of a tracking space
2023-03-07 22:12:02 +01:00
Calixte Denizet
b8dda089e2 Slightly modify the max width of a tracking space 2023-03-07 19:38:49 +01:00
Jonas Jenwald
6d3506548d [api-minor] Update the minimum supported Node.js version to 16
This patch updates the minimum supported environments as follows:
 - Node.js 16, which was released on 2021-04-20; see https://en.wikipedia.org/wiki/Node.js#Releases

Note also that Node.js 14 will very soon reach EOL, and thus no longer receive any security updates.
2023-03-07 16:33:56 +01:00
calixteman
ec5288caa5
Merge pull request #16121 from calixteman/issue16120
Use appearance stream to render locked annotations (bug 1723568)
2023-03-07 15:43:50 +01:00
Calixte Denizet
8db77cc361 Use appearance stream to render locked annotations (bug 1723568) 2023-03-07 15:01:31 +01:00
Jonas Jenwald
076fdbf6df
Merge pull request #16118 from Snuffleupagus/revert-update-rimraf
Revert "Update `rimraf` to version 4"
2023-03-07 13:38:30 +01:00
Jonas Jenwald
2f3dcc2327 [api-minor] Remove the deprecated onUnsupportedFeature functionality (PR 15758 follow-up)
This was deprecated in PR 15758, which has now been included in three official PDF.js releases.
While PR 15880 did limit the bundle-size impact of this functionality on e.g. the Firefox PDF Viewer, it still leads to some unnecessary "bloat" that these changes remove.
Furthermore, with this being deprecated there'd also be no effort put into e.g. extending the `UNSUPPORTED_FEATURES` list when handling future error cases.
2023-03-07 10:18:43 +01:00
Jonas Jenwald
2f2f1e5088 Revert "Update rimraf to version 4"
This reverts commit 32357e3d17.
2023-03-06 19:57:00 +01:00
calixteman
e11371c75f
Merge pull request #16110 from calixteman/norotate
[Annotation] Don't rotate an annotation when it has the NoRotate flag
2023-03-06 19:17:44 +01:00
Calixte Denizet
3849063d36 [Annotation] Don't rotate an annotation when it has the NoRotate flag 2023-03-06 17:27:11 +01:00
calixteman
652a6df62b
Merge pull request #16077 from calixteman/large_image
Render large images even if they're larger than the canvas limits (bug 1720282)
2023-03-05 15:38:51 +01:00
Calixte Denizet
05b0c9d7e6 Render large images even if they're larger than the canvas limits (bug 1720282)
The idea is to encode large image in BMP format (which is very simple and doesn't
require to compute any checksums) and then use createImageBitmap with a BMP blob
(which doesn't suffer of the Canvas/ImageData limits).
From a performance point of view, it isn't crazy (generating a large blob + decoding
it on the main thread is really not ideal) but at least we've something to display
which is a way better than a blank page (and one can notice that most of the time is
spent in decoding the image from the pdf stream).
2023-03-05 14:07:07 +01:00
Jonas Jenwald
d7e4be9cdb
Merge pull request #16107 from mozilla/dependabot/npm_and_yarn/minimist-1.2.7
Bump minimist from 1.2.5 to 1.2.7
2023-03-04 10:10:37 +01:00
dependabot[bot]
5cc65d193f
Bump minimist from 1.2.5 to 1.2.7
Bumps [minimist](https://github.com/minimistjs/minimist) from 1.2.5 to 1.2.7.
- [Release notes](https://github.com/minimistjs/minimist/releases)
- [Changelog](https://github.com/minimistjs/minimist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.7)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-04 02:42:21 +00:00
Ben Wagner
158c836e26 Correct PostScript trigonometric operators
PDF 32000-1:2008 7.10.5.1 "Type 4 (PostScript Calculator) Functions"
defers to the PostScript Language Reference for the description of these
functions. The PostScript Language Reference, third edition chapter 8
"Operators" defines the `angle` type as a "number of degrees". Section
8.1 defines "angle `sin` real", "angle `cos` real", and "num den `atan`
angle". The documentation for `atan` further states that it will return
an angle in degrees between 0 and 360.

Handle these operators correctly in `PostScriptEvaluator.execute`.
Convert the inputs to `sin` and `cos` from degrees to radians for use
with `Math.sin` and `Math.cos`. Correctly pop two values from the stack
for `atan`, use `Math.atan2`, and convert from radians to (positive)
degrees.
2023-03-03 17:25:11 -05:00
Jonas Jenwald
4e52bcee44
Merge pull request #16103 from Snuffleupagus/rm-direct-PDFDataRangeTransport
[api-minor] Remove calling `getDocument` directly with a `PDFDataRangeTransport`-instance (PR 15943 follow-up)
2023-03-02 18:25:00 +01:00
Jonas Jenwald
ceec93c832
[api-minor] Remove calling getDocument directly with a PDFDataRangeTransport-instance (PR 15943 follow-up)
This was deprecated in PR 15943, which has now been included in two official PDF.js releases.
Given that `PDFDataRangeTransport` is somewhat unlikely to be used outside of the *built-in* Firefox PDF Viewer, it doesn't seem necessary to wait longer before removing this.

Also, removes the specific error-message for GENERIC builds to not unnecessarily "advertise" using non-objects when calling the `getDocument`-function.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-03-02 15:12:01 +01:00
calixteman
d4216264e8
Merge pull request #16062 from calixteman/create_image_in_worker
[api-minor] Generate images in the worker instead of the main thread.
2023-03-02 13:34:50 +01:00
Calixte Denizet
fd03cd5493 [api-minor] Generate images in the worker instead of the main thread.
We introduced the use of OffscreenCanvas in #14754 and this patch aims
to use them for all kind of images.
It'll slightly improve performances (and maybe slightly decrease memory use).
Since an image can be rendered in using some transfer maps but because of
OffscreenCanvas we don't have the underlying pixels array the transfer maps
stuff is re-implemented in using the SVG filter feComponentTransfer.
2023-03-01 17:40:12 +01:00
Jonas Jenwald
9640add1f7
Merge pull request #16100 from Snuffleupagus/getDocument-canvasFactory
[api-minor] Move the `canvasFactory` option into `getDocument`
2023-03-01 10:34:11 +01:00
Jonas Jenwald
f42a2e8451
[api-minor] Move the canvasFactory option into getDocument
Rather than repeatedly initializing a `canvasFactory`-instance for every page, move it to the document-level instead.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-03-01 09:07:16 +01:00
Jonas Jenwald
22c9970309
Merge pull request #16095 from Snuffleupagus/worker-isOffscreenCanvasSupported
Check `OffscreenCanvas` support once on the worker-thread
2023-02-28 08:25:50 +01:00