Commit Graph

17516 Commits

Author SHA1 Message Date
Tim van der Meij
35202ec0f3
Merge pull request #16671 from Snuffleupagus/esm-parseDefaultPreferences
[ESM] Convert the "default preferences"-handling to use `import()` syntax
2023-07-09 15:38:30 +02:00
Tim van der Meij
1972b7311b
Merge pull request #16667 from Snuffleupagus/esm-cmaps
[ESM] Convert the "cmaps"-task to use `import()` syntax
2023-07-09 15:33:57 +02:00
Tim van der Meij
c0cc7f3eca
Merge pull request #16666 from Snuffleupagus/esm-wintersmith
[ESM] Convert the "wintersmith"-task to use `import()` syntax
2023-07-09 15:32:10 +02:00
Tim van der Meij
5a8ecbf560
Merge pull request #16665 from Snuffleupagus/esm-test
[ESM] Convert *most* of `test`-folder to use standard modules
2023-07-09 15:30:13 +02:00
Jonas Jenwald
6c601d3922 [ESM] Convert the "default preferences"-handling to use import() syntax
Unfortunately I wasn't able to come up with a *simple* way to just replace the synchronous `require`-call, since we need to ensure that the default preferences are available when bundling starts.
Hence this patch adds a new intermediate parsing-step in all the relevant gulp-tasks, but this shouldn't affect build-times noticeable since the amount of extra parsing is very small.

*Please note:* It's very possible that there's a better way to handle this, however I figured that unblocking further ESM-work is more important than a "perfect" solution.
2023-07-09 11:54:11 +02:00
Tim van der Meij
3efb276695
Merge pull request #16664 from Snuffleupagus/esm-terser
[ESM] Convert `parseMinified` to use `import()` syntax
2023-07-08 19:43:02 +02:00
Tim van der Meij
656c6d86fc
Merge pull request #16663 from Snuffleupagus/esm-importL10n
[ESM] Convert the `external/importL10n`-folder to use standard modules
2023-07-08 19:40:52 +02:00
Jonas Jenwald
f012fc5e70 [ESM] Convert the "cmaps"-task to use import() syntax 2023-07-08 18:52:58 +02:00
Tim van der Meij
42edc4d895
Merge pull request #16630 from Rob--W/crx-url-hash-init
Correct recognition of fragments at document load
2023-07-08 14:05:33 +02:00
Tim van der Meij
1567d022d9
Merge pull request #16631 from Rob--W/crx-remove-old-chrome-compat-code
[CRX] Drop code supporting ancient Chrome versions
2023-07-08 14:02:30 +02:00
Jonas Jenwald
ac3661972b [ESM] Convert the "wintersmith"-task to use import() syntax 2023-07-08 13:50:19 +02:00
Jonas Jenwald
a209ce811d [ESM] Convert *most* of test-folder to use standard modules 2023-07-08 13:13:04 +02:00
Jonas Jenwald
adfee2a723 [ESM] Convert parseMinified to use import() syntax 2023-07-08 10:01:16 +02:00
Jonas Jenwald
cec2a9a03f Update l10n files 2023-07-08 09:36:47 +02:00
Jonas Jenwald
a650fcd634 [ESM] Convert the external/importL10n-folder to use standard modules 2023-07-08 09:36:32 +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
Rob Wu
70db938fe7 [CRX] Drop code supporting ancient Chrome versions 2023-07-02 17:23:18 +02:00
Rob Wu
f2753d6220 [CRX] Avoid encoding the fragment in file key
Semantically, it is more correct to encode the fragment in the URL
instead of the URL-encoded `file` query parameter. This shouldn't matter
in practice, because `rewriteUrlClosure` in `chromecom.js` decodes the
`file` parameter and restores the fragment. However, as #16625 shows,
there was a case where this did not work as expected.
2023-07-02 15:31:35 +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
Rob Wu
1d07ef401e [CRX] Re-initialize initialBookmark after URL rewrite
`PDFViewerApplication` reads from `location.hash` to initialize
`initialBookmark`. But when extensions/chromium/pdfHandler.js prepares
the redirect URL, the reference fragment is encoded instead of bare.
`rewriteUrlClosure` in `chromecom.js` is responsible for decoding the
URL, but that currently runs too late.

To fix this, update `initialBookmark` after rewriting the URL.

This was not a problem in the past because `rewriteUrlClosure` in
`chromecom.js` executed before the initialization of `initialBookmark`.
2023-07-02 15:28:33 +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