Commit Graph

17632 Commits

Author SHA1 Message Date
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
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
calixteman
88c7c8b5bf
Merge pull request #16588 from calixteman/editor_stamp_2
[Editor] Add support for printing/saving newly added Stamp annotations
2023-06-28 22:42:54 +02:00
Jonas Jenwald
d329267926 Use Element.scrollTo unconditionally in the GrabToPan class
According to the MDN compatibility data this is available in all browsers that we currently support; please see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo#browser_compatibility
2023-06-28 12:43:36 +02:00
Jonas Jenwald
4f82dd3932 Create a GrabToPan-instance lazily in the PDFCursorTools class
Unless the user enables the "HandTool" we don't actually need to create a `GrabToPan`-instance.
2023-06-28 12:43:36 +02:00
Jonas Jenwald
789e318cf7 A couple of small tweaks of the PDFCursorTools class
- Introduce a few private fields for internal state.

 - Inline a small method at its only call-site.
2023-06-28 12:43:34 +02:00
Rob Wu
8330390757 Improve lint-chromium to output actionable information
Before this commit, lint-chromium complained without an obvious course
of action:

> Warning: Pref objects doesn't have the same length.
> Error: chromium/preferences_schema is not in sync

With this commit, the error message is more actionable:

> Warning: extensions/chromium/preferences_schema.json does not contain an entry for pref: enableFloatingToolbar
> Error: chromium/preferences_schema is not in sync
2023-06-28 12:30:21 +02:00
Jonas Jenwald
50488d7a47
Merge pull request #16608 from Snuffleupagus/PDFPageView-refactor-filterFactory
Re-factor how HCM highlight-filters are handled in the viewer components (PR 16593 follow-up)
2023-06-27 15:13:00 +02:00
Jonas Jenwald
a024cd0127 Re-factor how HCM highlight-filters are handled in the viewer components (PR 16593 follow-up)
This is something that I completely overlooked during review of PR 16593, since the idea is (obviously) that the viewer-components should be usable as-is without the user needing to manually pass in any *additional* parameters.

To support this we can very easily expose the current `FilterFactory`-instance on the `PDFPageProxy`-class[1], and if needed initialize the highlight-filters when initializing the page (again limited to the viewer-components).
2023-06-26 23:37:39 +02:00
Rob Wu
9aedf00ffe Revert "Temporarily stop listing the official Chrome extension in the main README"
This reverts commit afabbc28c5.
2023-06-26 18:54:11 +02:00
calixteman
c4a61a7692
Merge pull request #16593 from calixteman/popup_hcm
Improve highlightments and popups in HCM (bug 1830850)
2023-06-26 16:34:17 +02:00
Jonas Jenwald
d357906c3f
Merge pull request #16605 from Snuffleupagus/rm-enableFloatingToolbar-pref
[GeckoView] Remove the `enableFloatingToolbar` preference
2023-06-26 15:56:14 +02:00
Calixte Denizet
599b9498f2 [Editor] Add support for printing/saving newly added Stamp annotations
In order to minimize the size the of a saved pdf, we generate only one
image and use a reference in each annotation using it.
When printing, it's slightly different since we have to render each page
independantly but we use the same image within a page.
2023-06-26 15:47:05 +02:00
Jonas Jenwald
80b4708fa3 [GeckoView] Remove the enableFloatingToolbar preference
Note that we'll now display the toolbar unconditionally in GeckoView.
2023-06-26 15:17:03 +02:00
Jonas Jenwald
21383fb2d1
Merge pull request #16602 from Snuffleupagus/gulpfile-TESTING-nullish-coalescing
Use nullish coalescing when handling the `TESTING` build-target
2023-06-26 14:54:45 +02:00
Jonas Jenwald
d7ae2f86e8
Merge pull request #16604 from Snuffleupagus/pdfviewer_api-test-Node
Run the PDF.js-viewer API unit-test in Node.js environments (PR 16592 follow-up)
2023-06-26 14:50:45 +02:00
Calixte Denizet
c519cc821b Improve highlightments and popups in HCM (bug 1830850)
- Modify the text and background colors in popup to fit a11y requirements
- Add a backdrop filter on clickable areas in using a svg filter mapping
  canvas colors to Highlight and HighlightText ones.
2023-06-26 14:45:03 +02:00
Jonas Jenwald
5f5db4b160 Run the PDF.js-viewer API unit-test in Node.js environments (PR 16592 follow-up)
It occurred to me that we can actually run this unit-test in Node.js environments by making use of the preprocessor to stub out the browser globals there.
2023-06-26 09:37:34 +02:00
Jonas Jenwald
9e7023776e Use nullish coalescing when handling the TESTING build-target
Given that nullish coalescing is now available in all environments/browser that we support, we can (ever so slightly) simplify handling of the `TESTING` build-target.
2023-06-25 16:02:31 +02:00