Commit Graph

17170 Commits

Author SHA1 Message Date
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
Jonas Jenwald
45c332110e
Check OffscreenCanvas support once on the worker-thread
Currently we repeat the `FeatureTest.isOffscreenCanvasSupported` checks all over the worker-thread code, and with upcoming changes this will become even "worse".

Hence this patch, which changes the *worker-thread* default value for the `isOffscreenCanvasSupported`-parameter to `false` and moves the feature-testing into the `BasePdfManager`-constructor.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-02-27 12:27:28 +01:00
Tim van der Meij
2da2ac492e
Merge pull request #16093 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-02-26 13:22:23 +01:00
Tim van der Meij
580180a720
Bump versions in pdfjs.config 2023-02-26 13:15:43 +01:00
Jonas Jenwald
af64149885
Merge pull request #16086 from mozilla/Snuffleupagus-textLayer-OffscreenCanvas
Use `OffscreenCanvas` as intended for all code-paths in `src/display/text_layer.js` (PR 15722 follow-up)
2023-02-24 22:40:18 +01:00
Jonas Jenwald
5075d0495b
Use OffscreenCanvas as intended for all code-paths in src/display/text_layer.js (PR 15722 follow-up)
Currently some `getCtx` calls will have `isOffscreenCanvasSupported === undefined` set, meaning that `OffscreenCanvas` isn't being used as intended, since no `TextLayerRenderTask._isOffscreenCanvasSupported` property exists.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
2023-02-24 11:29:58 +01:00
calixteman
9c58d4f7f2
Merge pull request #16082 from calixteman/fix_class_in_path
[Acroform] Use the full path to find the node in the XFA datasets where to store the value
2023-02-23 13:38:54 +01:00
Calixte Denizet
3a21423386 [Acroform] Use the full path to find the node in the XFA datasets where to store the value
I noticed several 'Path not found' errors because of a field called #subform[2].
From the XFA specs, the hash is used for a class of elements in the template tree.
When we're looking for a node in the datasets tree, it doesn't make sense to search
for a class. Hence the path element starting with a hash are just skipped.
2023-02-23 12:09:39 +01:00
calixteman
e676c9388d
Merge pull request #16080 from calixteman/link_hcm
[a11y] Improve the visibility of link annotations in HCM
2023-02-22 20:31:51 +01:00
Calixte Denizet
a074525bfb [a11y] Improve the visibility of link annotations in HCM
In order to help to identify a link, we add a border around it with the LinkText color.
And backdrop colors are inverted when the mouse pointer hovers them, this way it should
help to identify the link where the pointer is.
2023-02-22 19:39:28 +01:00
Jonas Jenwald
3f33fbf8cf
Merge pull request #16079 from mozilla/Snuffleupagus-PDFObjects-bitmap
Move the `ImageBitmap` clean-up into the `PDFObjects` class
2023-02-22 13:51:12 +01:00
Jonas Jenwald
1b076b7a35
Move the ImageBitmap clean-up into the PDFObjects class
With upcoming changes we'll potentially start to cache `ImageBitmap` data at the document-level, in addition to just at the page-level.
Hence we need to ensure that such data is actually released on clean-up, and rather than duplicating the existing *manual* handling this code is instead moved into the `PDFObjects.clear` method. (In my opinion, this is an overall improvement even without globally cached `ImageBitmap` data.)

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it's correct and makes sense.
2023-02-21 12:00:45 +01:00
calixteman
534b22aec5
Merge pull request #16071 from calixteman/issue16067
[JS] Send a Validate action on change on Choice widget
2023-02-20 11:15:20 +01:00
Calixte Denizet
dca54c8f8a [JS] Send a Validate action on change on Choice widget 2023-02-19 16:33:05 +01:00
Tim van der Meij
255e982542
Merge pull request #16056 from Snuffleupagus/xfaLayer-on-top
Don't try to place the `xfaLayer` "on top" in regular PDF documents
2023-02-19 12:22:10 +01:00
Tim van der Meij
f2baa48608
Merge pull request #16055 from Snuffleupagus/deprecated-Node-Buffer
[api-minor] Deprecate providing binary data as `Buffer` in Node.js environments
2023-02-19 12:20:09 +01:00
Tim van der Meij
9fac676796
Merge pull request #16054 from Snuffleupagus/Driver-getDocument-cleanup
A little clean-up of the `getDocument` call in `test/driver.js`
2023-02-19 12:12:07 +01:00
calixteman
13af3f3442
Merge pull request #16065 from calixteman/issue16063
Don't replace an eol by a whitespace when the last char is a Katakana-Hiragana diacritic
2023-02-17 13:40:54 +01:00
Calixte Denizet
fc7d74385f Don't replace an eol by a whitespace when the last char is a Katakana-Hiragana diacritic 2023-02-16 11:31:58 +01:00
Jonas Jenwald
3c66b031e3 Don't try to place the xfaLayer "on top" in regular PDF documents
Given that we only create an `xfaLayer` in "pure" XFA-documents, this code can be moved into the appropriate branch instead.
2023-02-14 12:54:44 +01:00