1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00
Commit graph

6419 commits

Author SHA1 Message Date
Jonas Jenwald
9b41bfc374 Introduce helper functions for parsing /Matrix and /BBox arrays 2024-05-03 22:37:50 +02:00
Jonas Jenwald
52f7ff155d Validate even more dictionary properties
This checks primarily Arrays, but also some other properties, that we'll end up sending (sometimes indirectly) to the main-thread.
2024-05-03 22:37:14 +02:00
Jonas Jenwald
1b811ac113
Merge pull request #18034 from Snuffleupagus/FileSpec-filename-stripPath
[api-minor] Improve the `FileSpec` implementation
2024-05-03 09:03:17 +02:00
Jonas Jenwald
a790f2df5d [api-minor] Remove the unused onlyStripPath option from the getFilenameFromUrl helper function 2024-05-03 08:29:41 +02:00
Jonas Jenwald
c419c8333b
Merge pull request #18037 from Snuffleupagus/validate-more-widths
Add even more validation of width-data (PR 18017 follow-up)
2024-05-02 14:41:02 +02:00
Jonas Jenwald
6c05f8b381 Add even more validation of width-data (PR 18017 follow-up)
I missed this case in PR 18017, sorry about that.
2024-05-02 11:24:15 +02:00
calixteman
33732ff2cb
Merge pull request #18035 from calixteman/rm_max_group_size
Remove the limit used to decided if a group canvas must be upscaled or not
2024-05-01 20:14:28 +02:00
Jonas Jenwald
2b69fb76ac [api-minor] Improve the FileSpec implementation
- Check that the `filename` is actually a string, before parsing it further.
 - Use proper "shadowing" in the `filename` getter.
 - Add a bit more validation of the data in `pickPlatformItem`.
 - Last, but not least, return both the original `filename` and the (path stripped) variant needed in the display-layer and viewer.
2024-05-01 18:02:05 +02:00
Calixte Denizet
5c771628de Remove the limit used to decided if a group canvas must be upscaled or not
It fixes issues #14982 and #14724.
The main problem of upscaling a canvas is that it can induces some pixelation
(see issue #14724). So this patch is just removing the limit and as a side
effect it fixes issue #14982.
As far as I can tell, in looking different profiles (especially some memory profile)
in using the Firefox profiler, I don't see any noticeable difference in term of
memory use.
2024-05-01 18:01:54 +02:00
Jonas Jenwald
16dbf5dcfd
Merge pull request #18031 from Snuffleupagus/issue-18030
[api-minor] Expose the /Desc-attribute of file attachments in the viewer (issue 18030)
2024-05-01 17:53:22 +02:00
Calixte Denizet
82989e6790 [api-minor] Remove the use of (get/put)ImageData when drawing SMasks (bug 1874013)
and implement then in using some SVG filters and composition.
Composing in using destination-in in order to multiply RGB components by
the alpha from the mask isn't perfect: it'd be a way better to natively have
alpha masks support, it induces some small rounding errors and consequently
computed RGB are approximatively correct.
In term of performance, it's a real improvement, for example, the pdf in
issue #17779 is now rendered in few seconds.
There are still some room for improvement, but overall it should be a way
better.
2024-05-01 15:40:44 +02:00
Jonas Jenwald
bf4e36d1b5 [api-minor] Expose the /Desc-attribute of file attachments in the viewer (issue 18030)
In the viewer this will be displayed in the `title` of the hyperlink, which is probably the best we can do here given how the viewer is implemented.
2024-05-01 09:02:11 +02:00
Jonas Jenwald
f6cd03955b [api-minor] Move the page reference/number caching into the API
Rather than having to handle this *manually* throughout the viewer, this functionality can instead be moved into the API which simplifies the code slightly.
2024-04-29 18:54:06 +02:00
Jonas Jenwald
2b2ade7883
Merge pull request #18018 from Snuffleupagus/CompiledFont-tweak-caching
Reduce code-duplication when caching data in `CompiledFont.getPathJs`
2024-04-29 17:39:35 +02:00
Jonas Jenwald
85ff8f34e2 Reduce code-duplication when caching data in CompiledFont.getPathJs 2024-04-29 13:18:31 +02:00
Jonas Jenwald
d411a072a4 Add more validation of width-data
The current `PartialEvaluator.extractWidths` implementation only contains *partial* validation of the width-data.
2024-04-29 10:51:16 +02:00
Jonas Jenwald
08eb0566f7 Validate additional font-dictionary properties 2024-04-29 08:21:28 +02:00
Calixte Denizet
551e63901c Simplify the way to pass the glyph drawing instructions from the worker to the main thread
and remove the use of eval in the font loader.
2024-04-27 21:28:31 +02:00
Calixte Denizet
b511878ba7 Always enable smoothing when rendering downscaled image
and rely on the Interpolate flag only when the image is upscaled.
Fixes #16273.
2024-04-24 18:33:21 +02:00
calixteman
d1f494d68c
Merge pull request #17986 from calixteman/fix_struct_tree
Allow to insert several annotations under the same parent in the structure tree
2024-04-24 18:32:00 +02:00
Tim van der Meij
885dd72433
Merge pull request #17984 from Snuffleupagus/issue-17981
Validate explicit destinations on the worker-thread to prevent `DataCloneError` (issue 17981)
2024-04-24 16:25:02 +02:00
Calixte Denizet
45fa867577 Allow to insert several annotations under the same parent in the structure tree
While testing stamp insertion with the added pdf, I noticed that the tags using a MCID
weren't considered when trying to attach an annotation to it.
2024-04-24 16:23:05 +02:00
Calixte Denizet
55808238e4 Set correctly the change property for the event triggered when a choice list is changed
It fixes #17998.
2024-04-24 14:48:22 +02:00
Jonas Jenwald
7206d0a237 Validate explicit destinations on the worker-thread to prevent DataCloneError (issue 17981)
*Note:* This borrows a helper function from the viewer, however the code cannot be directly shared since the worker-thread has access to various primitives.
2024-04-22 22:51:35 +02:00
Tim van der Meij
522af265a7
Merge pull request #17977 from Snuffleupagus/parseImageProperties-TypedArray
Update `JpxImage.parseImageProperties` to support TypedArray data in IMAGE_DECODERS builds
2024-04-22 18:31:31 +02:00
Jonas Jenwald
9e80c6d228
Merge pull request #17978 from Snuffleupagus/pr-17428-followup
Extend the globally cached image main-thread copying to "complex" images as well (PR 17428 follow-up)
2024-04-22 16:46:23 +02:00
Calixte Denizet
55f943c4fa Use the pdf.js warn when using jpx decoder
Fixes #17980.
2024-04-22 16:02:45 +02:00
Tim van der Meij
335d8394cd
Merge pull request #17979 from Snuffleupagus/image-errors-shorter-msg
[api-minor] Remove the image-related error message prefixes
2024-04-22 15:35:10 +02:00
calixteman
9d891883b7
Merge pull request #17970 from calixteman/delete_from_xref
Correctly update the xref table when an annotation is deleted
2024-04-22 15:22:01 +02:00
Jonas Jenwald
912b57b95d [api-minor] Remove the image-related error message prefixes
Other custom errors, based on `BaseException`, do not use such a format.
2024-04-20 12:51:45 +02:00
Jonas Jenwald
91898e5923 Extend the globally cached image main-thread copying to "complex" images as well (PR 17428 follow-up)
In PR 17428 this functionality was limited to "larger" images, to not affect performance negatively. However it turns out that it's also beneficial to consider more "complex" images, regardless of their size, that contain /SMask or /Mask data; see issue 11518.
2024-04-20 11:10:09 +02:00
Jonas Jenwald
8970786d5b Update JpxImage.parseImageProperties to support TypedArray data in IMAGE_DECODERS builds
Given that the `decode` method only returns the actual image-data, a user would now need to invoke `parseImageProperties` to obtain e.g. the width and height.
This method only accepts `BaseStream`-instances, which are (obviously) not exposed, hence we extend it in IMAGE_DECODERS builds to wrap TypedArray data into the expected format.
2024-04-20 09:38:52 +02:00
Calixte Denizet
c57a0f38e9 [Editor] Don't show the context menu when resizing 2024-04-19 15:22:46 +02:00
Calixte Denizet
901d995a7e Correctly update the xref table when an annotation is deleted 2024-04-18 21:27:39 +02:00
Calixte Denizet
71ea8499f0 [Editor] Provide an element to render in the annotation layer after a freetext has been edited (bug 1890535) 2024-04-18 13:29:41 +02:00
Tim van der Meij
7290faf840
Merge pull request #17956 from calixteman/jpx_exceptions
[JPX] Throw an exception with the error messages returned by openjpeg
2024-04-16 20:48:23 +02:00
Calixte Denizet
ebcae3014c [JPX] Throw an exception with the error messages returned by openjpeg 2024-04-16 19:02:24 +02:00
Tim van der Meij
c08b09d3b9
Fix JpxImage API issues (PR 17946 follow-up)
This commit changes the `JpxImage.decode` method signature to define the
`ignoreColorSpace` argument as optional with a default value. Note that
we already set this default value in the `getBytes` method of the
`src/core/decode_stream.js` file since this option only seems useful for
certain special cases and therefore shouldn't be mandatory to provide.

Moreover, the JPX fuzzer is changed to use the new `JpxImage` API.
2024-04-16 18:02:47 +02:00
calixteman
12c4119cbd
Merge pull request #17946 from calixteman/openjpeg
[api-minor] Add a jpx decoder based on OpenJPEG 2.5.2
2024-04-16 13:41:58 +02:00
Calixte Denizet
2e83cfbbc1 [api-minor] Add a jpx decoder based on OpenJPEG 2.5.2
The decoder is compiled in WASM:
https://github.com/mozilla/pdf.js.openjpeg

Fixes #17289, #17061, #16485, #13051, #6365, #4648, #12213.
2024-04-16 12:54:36 +02:00
Jonas Jenwald
a41bb40fbb [api-minor] Update the minimum supported Safari version to 16.4
This patch updates the minimum supported browsers as follows:
 - Safari 16.4, which was released on 2023-03-27; see https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes

Nowadays we usually we try, where feasible and possible, to support browsers/environments that are about two years old. The reasons for limiting support to a slightly more recent Safari version include:
 - Safari has always been slower, compared to other browsers, at implementing e.g. new JavaScript features.
 - Trying to provide support for Safari is often difficult, and over the years we have seen *a lot* of bugs that are specific to Safari.
 - Safari is, and has been for many years, only listed as "mostly" supported in the FAQ.
 - This allows us to remove feature-testing, only relevant to Safari, from the main code-base.

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 core 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
2024-04-15 12:44:37 +02:00
Calixte Denizet
acc56491c9 Warn when a non-embedded font has an invalid name
It can be helpful to find out some heuristics when trying
to find a substitution font.
2024-04-12 13:59:18 +02:00
Calixte Denizet
52ea2333b3 Remove the tag for missing font subset when trying to find a substitution
Fixes #17929.
2024-04-11 20:34:28 +02:00
calixteman
77ee914bd6
Merge pull request #17882 from calixteman/bug1889122
Use the string value of the field when calling the Format callback (bug 1889122)
2024-04-10 09:40:54 +02:00
Calixte Denizet
b643c0fcfb Use the string value of the field when calling the Format callback (bug 1889122) 2024-04-09 22:52:11 +02:00
Calixte Denizet
41aaa083df Don't render annotations with a null dimension
Fixes #17906.
2024-04-09 16:03:49 +02:00
calixteman
a208d6bca7
Merge pull request #17903 from calixteman/moved_freetext
[Editor] Avoid calling setTimeout when editing an existing freetext
2024-04-09 09:48:17 +02:00
Calixte Denizet
3b93fdea26 [Editor] Avoid calling setTimeout when editing an existing freetext
The code was added in order to guess if an editor has been moved but
it's simpler to just set a variable when it's dragged or moved with
the keyboard. This way we remove a bit of asynchronicity.
2024-04-08 22:43:39 +02:00
Tim van der Meij
30b65ca067
Merge pull request #17907 from calixteman/fix_draw_ink
[Editor] Don't add an already added editor (bug 1890367)
2024-04-08 20:44:21 +02:00
Calixte Denizet
976ee96aa8 [Editor] Don't add an already added editor (bug 1890367) 2024-04-08 19:50:55 +02:00