Commit Graph

17499 Commits

Author SHA1 Message Date
Jonas Jenwald
a209ce811d [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
Jonas Jenwald
5696c3aa3a
Merge pull request #16658 from Snuffleupagus/test-more-APIs
Add unit-tests to check that more PDF.js APIs expose the expected functionality
2023-07-08 08:16:57 +02:00
calixteman
52c98eb751
Merge pull request #16659 from calixteman/edit_freetexts
[Editor] Edit an existing FreeText annotation in double-clicking on it (bug 1787298)
2023-07-07 22:02:11 +02:00
Jonas Jenwald
c625230c71
Merge pull request #16661 from Snuffleupagus/issue-16660
Don't try to hide an already invisible PopupAnnotation (issue 16660)
2023-07-07 20:47:38 +02:00
Jonas Jenwald
559ea194f2 Don't try to hide an already invisible PopupAnnotation (issue 16660) 2023-07-07 19:13:48 +02:00
Calixte Denizet
5c5f9af803 [Editor] Edit an existing FreeText annotation in double-clicking on it (bug 1787298) 2023-07-07 17:44:45 +02:00
calixteman
c33e6ceb03
Merge pull request #16650 from calixteman/editor_allow_svg
[Editor] Support svg images in the stamp annotation
2023-07-07 16:30:12 +02:00
Calixte Denizet
4fcc2ef23f [Editor] Support svg images in the stamp annotation
createImageBitmap doesn't work with svg files (see bug 1841972), so we need to workaround
this in using an Image.
When printing/saving we must rasterize the image, hence we get the biggest bitmap as image
reference to avoid duplications or poor quality on rendering.
2023-07-07 15:59:13 +02:00
Jonas Jenwald
506bca5e6d Add unit-tests to check that more PDF.js APIs expose the expected functionality
Similar to e.g. PR 16587, let's ensure that the `pdf.worker.js` and `pdf.image_decoders.js` files expose the expected functionality.
2023-07-07 12:36:21 +02:00
calixteman
eb2527e9d7
Merge pull request #16652 from calixteman/rm_all_exceptions
[Editor] Avoid to throw when deleting some invisible editors
2023-07-06 19:11:44 +02:00
Jonas Jenwald
091266c6fe
Merge pull request #16648 from Snuffleupagus/AppearanceStreamEvaluator-setFillColorSpace
Improve `parseAppearanceStream` to handle more "complex" ColorSpaces
2023-07-06 18:30:17 +02:00
Jonas Jenwald
c5caa98e8d
Merge pull request #16649 from Snuffleupagus/stamp-l10n
[Editor] Add l10n-strings for the Stamp-editor (PR 16585 follow-up)
2023-07-06 18:04:08 +02:00
Jonas Jenwald
7a896d1c4b [Editor] Add l10n-strings for the Stamp-editor (PR 16585 follow-up)
This ought to have been included in PR 16585, since we obviously need default (en-US) l10n-strings for this feature.
2023-07-06 17:57:29 +02:00
Calixte Denizet
e4b4d222fa [Editor] Avoid to throw when deleting some invisible editors 2023-07-06 16:55:51 +02:00
Jonas Jenwald
6442a6cc4e Improve parseAppearanceStream to handle more "complex" ColorSpaces
The existing code is unable to *correctly* extract the color from the appearance-stream when the ColorSpace-data is "complex". To reproduce this:
 - Open `freetexts.pdf` in the viewer.
 - Note the purple color of the "Hello World from Preview" annotation.
 - Enable any of the Editors.
 - Note how the relevant annotation is now black.
2023-07-06 15:58:09 +02:00
calixteman
8281bb8858
Merge pull request #16585 from calixteman/editor_stamp_1
[Editor] Add a basic stamp editor  (bug 1790255)
2023-07-06 12:21:50 +02:00
Jonas Jenwald
716493f10a
Merge pull request #16646 from Snuffleupagus/default_appearance-CMYK-typos
Fix typos when handling CMYK colors in `src/core/default_appearance.js`
2023-07-06 12:05:06 +02:00
Calixte Denizet
37bd78c707 [Editor] Add a basic stamp editor (bug 1790255)
For now it allows to add a stamp annotation with an image selected from the file system.
2023-07-06 11:27:50 +02:00
Jonas Jenwald
174d04fd27 Fix typos when handling CMYK colors in src/core/default_appearance.js
Note how we're accidentally using the wrong operator when trying to parse CMYK colors. I'm not aware of any bugs caused by this, since it seems uncommon in practice for annotations to specify text-colors in CMYK format.
2023-07-06 11:12:16 +02:00
calixteman
2a837ba0b5
Merge pull request #16645 from calixteman/editor_simplify_aspectratio
[Editor] Use css aspect-ratio property to keep the aspect ratio during resize
2023-07-06 10:17:03 +02:00
Calixte Denizet
fab1157549 [Editor] Use css aspect-ratio property to keep the aspect ratio during resize
It slightly simplifies the implementation and it avoids some possible artifacts
when resizing too quickly.
2023-07-06 09:21:37 +02:00
calixteman
683cdf44db
Merge pull request #16641 from calixteman/mv_aspectratio_to_editor
[Editor] Move the 'keep aspect ratio' stuff to the AnnotationEditor level
2023-07-05 21:03:00 +02:00
Calixte Denizet
caf3462911 [Editor] Move the 'keep aspect ratio' stuff to the AnnotationEditor level
It'll help to avoid code duplication between the different editors having
this feature.
2023-07-05 18:32:58 +02:00
calixteman
66fc19b272
Merge pull request #16640 from calixteman/freetext_ap
[Editor] When saving/printing a FreeText, use the identity matrix for the AP and set the cm when rendering it
2023-07-05 17:53:36 +02:00
Calixte Denizet
77656ce881 [Editor] When saving/printing a FreeText, use the identity matrix for the AP and set the cm when rendering it
When there was a rotation, the generated bbox was wrong because of an inversion
between width and height.
This patch aims to fix this issue in re-writing the FreeText code generation
to have something similar to what Acrobat does.
And fix the name of the font which wasn't the correct one when calling the
evaluator.
2023-07-05 16:37:01 +02:00
calixteman
6d82f7f66f
Merge pull request #16637 from calixteman/issue16636
[Editor] Fix dimensions of a rotated FreeText after a dimensions change
2023-07-05 09:41:49 +02:00
Calixte Denizet
1ce6668a70 [Editor] Fix dimensions of a rotated FreeText after a dimensions change 2023-07-04 23:56:24 +02:00
Jonas Jenwald
9802bd805e
Merge pull request #16635 from Snuffleupagus/README-tweaks
Tweak the README slightly
2023-07-04 13:25:16 +02:00
Jonas Jenwald
e96c89d7a1 Tweak the README slightly
- Update the "Getting the Code" section to specifically mention Mozilla Firefox, since while the development viewer *works* it may look slightly "broken" in Chromium-based browsers. (This is caused by a lack of support for unprefixed CSS properties, e.g. `mask-image`, however this does *not* affect the built PDF.js viewer.)

 - Remove the Twitter-link, since that account has not been updated since 2016 (i.e. over seven years ago).
2023-07-04 11:32:25 +02:00
Tim van der Meij
8b50836d76
Merge pull request #16629 from timvandermeij/bump
Bump versions in `pdfjs.config`
2023-07-02 15:28:47 +02:00
Tim van der Meij
f3df202a31
Bump versions in pdfjs.config 2023-07-02 15:22:05 +02:00
Tim van der Meij
2c74323e3d
Merge pull request #16628 from Snuffleupagus/app-webViewerInitialized-inline
Inline the `webViewerInitialized` function in `PDFViewerApplication.run`
2023-07-02 13:27:12 +02:00
Jonas Jenwald
58252a528d Inline the webViewerInitialized function in PDFViewerApplication.run
Given the size of this function respectively method, it seems reasonable to simply inline the `webViewerInitialized`-code here.
2023-07-02 11:43:28 +02:00
Jonas Jenwald
cae8fe4c7e Move the setTitleUsingUrl-call into PDFViewerApplication.initPassiveLoading
This seems overall nicer, rather than having to "manually" call this when initializing passive loading.
2023-07-02 11:43:16 +02:00
Tim van der Meij
73b6ee5325
Merge pull request #16612 from erm1116/fix-contentscript-updateEmbedElement
Fix reading property of null object in chrome extension's updateEmbedElement function
2023-07-01 13:30:37 +02:00
Tim van der Meij
8a954823b5
Merge pull request #16616 from Snuffleupagus/PDFCursorTools-tweaks
A couple of small tweaks of the `PDFCursorTools` class
2023-07-01 13:04:44 +02:00
Tim van der Meij
e070e730c7
Merge pull request #16627 from Snuffleupagus/rm-Node-Buffer
[api-minor] Stop "supporting" binary data provided as `Buffer` in Node.js environments (PR 16055 follow-up)
2023-07-01 13:00:19 +02:00
Tim van der Meij
366a4ff1e9
Merge pull request #16626 from Snuffleupagus/rm-pageColors-supports-check
[api-minor] Remove the `CSS.supports` checks for the `pageColors`-option in the GENERIC viewer
2023-07-01 12:58:30 +02:00
Tim van der Meij
94015c71ad
Merge pull request #16601 from Rob--W/crx-maintained-again
Revert "Temporarily stop listing the official Chrome extension in the main README"
2023-07-01 12:54:45 +02:00
Tim van der Meij
d057caedf5
Merge pull request #16607 from Rob--W/lint-chromium-actionable-warnings
Improve lint-chromium to output actionable information
2023-07-01 12:53:56 +02:00
Jonas Jenwald
25bac064d8 [api-minor] Stop "supporting" binary data provided as Buffer in Node.js environments (PR 16055 follow-up)
Given that the PDF.js library has never officially supported/documented that binary data can be provided as a `Buffer`, and that it's been explicitly deprecated in *four* releases, it seems reasonable that we outright reject such data instead (to reduce the amount of Node.js specific code-paths).
2023-07-01 10:34:18 +02:00
Jonas Jenwald
be775143b2 [api-minor] Remove the CSS.supports checks for the pageColors-option in the GENERIC viewer
Given the browsers that we currently support it's probably not necessary to keep the checks for the color-values.
2023-06-30 18:37:16 +02:00
Jonas Jenwald
ac937a9b3c
Merge pull request #16622 from Snuffleupagus/image_decoders-rm-polyfill-comment
Remove outdated polyfill comment from `src/pdf.image_decoders.js`
2023-06-30 17:18:45 +02:00
erm1116
fcf38f6ae9 fix: use node.insertBefore for adding embed element 2023-06-30 22:38:59 +09:00
Jonas Jenwald
ffa9795ca9
Merge pull request #16620 from Snuffleupagus/AnnotationStorage-transfers
Move the `transfers` computation into the `AnnotationStorage` class
2023-06-30 14:28:55 +02:00
Jonas Jenwald
2f80fc1b3d
Merge pull request #16623 from Snuffleupagus/fully-rm-render-canvasFactory
Fully remove the `canvasFactory` option from `PDFPageProxy.render` (PR 16242 follow-up)
2023-06-30 10:25:45 +02:00
Jonas Jenwald
64aa28953d Fully remove the canvasFactory option from PDFPageProxy.render (PR 16242 follow-up)
We've now been throwing an Error in *three* releases if the `canvasFactory` option is provided, hence it ought to be fine to stop doing that and simply ignore the option instead.
2023-06-30 09:21:45 +02:00
Jonas Jenwald
d3723cec95 Remove outdated polyfill comment from src/pdf.image_decoders.js
Given that none of the mentioned polyfills are used any more, the comment is no longer helpful.
2023-06-30 07:29:45 +02:00
Jonas Jenwald
39113baa33 Move the transfers computation into the AnnotationStorage class
Rather than having to *manually* determine the potential `transfers` at various spots in the API, we can let the `AnnotationStorage.serializable` getter include this.
To further simplify things, we can also let the `serializable` getter compute and include the `hash`-string as well.
2023-06-29 19:51:57 +02:00
Jonas Jenwald
f373fcb356 Remove a couple of unused options from the GrabToPan constructor
These options are completely unused in the PDF.js viewer, and given that the last update of the `GrabToPan`-code from upstream was in 2016 it shouldn't hurt to remove them.
2023-06-29 13:16:10 +02:00