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

3928 commits

Author SHA1 Message Date
Jonas Jenwald
59cb9a064e Extend getGlyphMapForStandardFonts with some Cyrillic entries (issue 19550) 2025-02-26 10:16:06 +01:00
Ross Johnson
4f25d7f6cd Fix decryption of R=4, V=4 files with < 16-byte keys by 0-padding - undocumented but matches Acrobat behavior (issue #19484) 2025-02-24 15:36:37 -06:00
calixteman
f9aa8e1d15
Merge pull request #19539 from calixteman/paste_signature
[Editor] Shift the signature editor when pasted
2025-02-24 16:07:50 +01:00
Hector Rincon
c19e70f6d9 Fix the link for issue5939.pdf
Web archive no longer has the revision for the saved PDF referenced in
that test case, so this updates that link to a more recent revision to
enable the tests to run on a clean clone.
2025-02-23 15:15:11 -08:00
Calixte Denizet
cc3d6ab539 [Editor] Shift the signature editor when pasted
The idea is to avoid to have the pasted editor hidding the copied one:
the user could think that nothing happened.
So the top-left corner of the pasted one is moved to the bottom-right corner of the copied one.
2025-02-23 21:35:01 +01:00
Tim van der Meij
acc5a2153a
Introduce a generic clearEditors helper function
This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
2025-02-23 20:49:04 +01:00
Tim van der Meij
f155b69c07
Introduce a generic selectEditors helper function
This replaces the various copies of this logic with a single helper that
we template for each editor type, similar to what we already do for the
`switchToEditor` helper.
2025-02-23 20:48:24 +01:00
Tim van der Meij
060ef0e15e
Deduplicate the waitForPointerUp helper function in the highlight editor integration tests
The helper function is available in `test_utils.mjs` since commit
3fe55ba, so we can remove the local copy by importing it.
2025-02-23 20:48:17 +01:00
Tim van der Meij
07629e105c
Deduplicate the getXY helper function in the highlight editor integration tests
The helper function is available in `test_utils.mjs` since commit
301f1bb, so by exporting it there it can be reused.
2025-02-23 20:48:17 +01:00
Tim van der Meij
4f3dbcf24d
Remove the waitForEditorMovedInDOM helper function export
It's no longer used outside of `test_utils.mjs` since commit 301f1bb.
2025-02-23 20:48:17 +01:00
Calixte Denizet
301f1bbf2b [Editor] Fix the position in the page of a drawing after it has been moved with the keyboard
When a drawing was moved with arrow keys and then printed or saved, the drawing wasn't moved finally.
So the fix is just about calling onTranslated once the translation is done.
2025-02-22 15:19:14 +01:00
Jonas Jenwald
a648e1e769
Merge pull request #19537 from Snuffleupagus/api-useWasm
[api-minor] Re-factor how the `useWorkerFetch` option is used internally
2025-02-22 14:16:31 +01:00
Tim van der Meij
23d7398371
Merge pull request #19531 from stof/patch-1
Disable the loading of node types in the type tests
2025-02-22 13:47:44 +01:00
Jonas Jenwald
641e2f506e [api-minor] Re-factor how the useWorkerFetch option is used internally
With the recently added OpenJPEG no-wasm fallback we need to send the `wasmUrl` option to the worker-thread *regardless* of the value of the `useWorkerFetch` option, since the fallback won't work if we don't have a URL to `import` it from.
For consistency the code is re-factored to always send the factory-urls to the worker-thread, and simply check the `useWorkerFetch` option there instead.

Also, as a follow-up to PR 19525, introduce a new `useWasm` option that can be used in e.g. browser-tests to forcibly disable WebAssembly usage.
2025-02-22 09:56:53 +01:00
Jonas Jenwald
6d3bb47655
Merge pull request #19525 from calixteman/bug1935076_part2
Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076)
2025-02-22 09:34:40 +01:00
calixteman
c2e616dfc9
Merge pull request #19534 from calixteman/signature_description_test
[Editor] Add a test for copy & paste a signature editor
2025-02-21 23:01:31 +01:00
Jonas Jenwald
553ec7babc
Merge pull request #19128 from nicolo-ribaudo/draw-page-portion
[api-minor] Render high-res partial page views when falling back to CSS zoom (bug 1492303)
2025-02-21 22:24:41 +01:00
Calixte Denizet
814d2bbe6d [Editor] Add a test for copy & paste a signature editor
This patch fixes an issue when pasting: an exception was thrown when pasting.
And while writing the test and comparing the paths in the svg, I found a difference
which is fixed thanks to call to the right constructor (to take into account the inheritance)
in inkdraw.js
2025-02-21 21:43:19 +01:00
Xiphoseer
24aa39eb14 Consider textRise when showing type3 font glyphs
Add test case for issue 19532
2025-02-21 21:31:04 +01:00
Calixte Denizet
36e4f5c222 Provide a js fallback when the wasm version of openjpeg is failing to load (bug 1935076) 2025-02-21 19:03:47 +01:00
Nicolò Ribaudo
458b2ee402
[api-minor] Render high-res partial page views when falling back to CSS zoom (bug 1492303)
When rendering big PDF pages at high zoom levels, we currently fall back
to CSS zoom to avoid rendering canvases with too many pixels. This
causes zoomed in PDF to look blurry, and the text to be potentially
unreadable.

This commit adds support for rendering _part_ of a page (called
`PDFPageDetailView` in the code), so that we can render portion of a
page in a smaller canvas without hiting the maximun canvas size limit.

Specifically, we render an area of that page that is slightly larger
than the area that is visible on the screen (100% larger in each
direction, unless we have to limit it due to the maximum canvas size).
As the user scrolls around the page, we re-render a new area centered
around what is currently visible.
2025-02-21 10:00:55 -08:00
Christophe Coevoet
93a5fa5b88
Disable the loading of node types in the type tests
Those type tests are performing type checking on a project using DOM APIs, intended to reflect the usage in a non-node project.
Not loading the node types in that project ensures that the library type declarations don't force a dependency on the node types.
2025-02-21 14:10:35 +01:00
calixteman
34ef74cf0e
Merge pull request #19518 from Snuffleupagus/JpegStream-EXIF-replace
Move the EXIF-block replacement into `JpegStream` (PR 19356 follow-up)
2025-02-20 23:11:43 +01:00
Calixte Denizet
12ba81718c [Editor] Remove the error panel when the user click on an other tab (bug 1949201) 2025-02-20 14:03:59 +01:00
Jonas Jenwald
d5ce35f744 Move the EXIF-block replacement into JpegStream (PR 19356 follow-up)
Currently we modify the EXIF-block in place, which may end up "breaking" the JPEG-data of the original PDF document since e.g. saving it from the viewer no longer contains the real EXIF-block.
Hence the EXIF-block replacement is moved into the `JpegStream` class, such that we can copy the data before doing the replacement.
2025-02-20 12:41:39 +01:00
Jonas Jenwald
d10cea5dd0
Merge pull request #19470 from ryzokuken/fix-autolinking-edge-cases
Fix autolinking errors
2025-02-19 14:43:14 +01:00
Ujjwal Sharma
38ab358fb1 Fix autolinking error due to redundant annotations on zooming
Fix an issue where redundant links were being added to the annotation
layer on zooming on the page with the links.
2025-02-19 13:18:31 +01:00
Ujjwal Sharma
70e2873430 Fix autolinking errors due to regex and email validation
Fix some edge cases in the autolinking logic with the regex as well as
validating email domains and add unit tests for them.

Fixes: https://github.com/mozilla/pdf.js/issues/19462
2025-02-19 13:18:31 +01:00
Jonas Jenwald
63b397f49d
Merge pull request #19513 from Snuffleupagus/issue-19510
Don't cache free/missing XRef entries (issue 19510)
2025-02-18 21:23:01 +01:00
Jonas Jenwald
db7cf40a30 Don't cache free/missing XRef entries (issue 19510)
During the XRef stream parsing we're attempting to lookup an entry that hasn't yet been found, since parsing is currently running, and given that we'd also cache free/missing XRef entries we'd then return an incorrect value during normal PDF parsing.

The simplest solution here is to just not cache free/missing XRef entries, since a properly generated PDF document shouldn't be trying to access objects it doesn't contain.
Furthermore, the amount of "extra" parsing now needed for such XRef entries shouldn't be significant enough to be an issue.
2025-02-18 18:04:00 +01:00
calixteman
5bc3cb839b
Merge pull request #19512 from calixteman/signature_test2
[Editor] Add two integration tests for the signature feature
2025-02-18 18:03:00 +01:00
Jonas Jenwald
426c730e11
Merge pull request #19504 from Snuffleupagus/eslint-fix-arrow-body-style
Fix all outstanding ESLint `arrow-body-style` warnings
2025-02-18 17:52:36 +01:00
Calixte Denizet
3fe55baa5e [Editor] Add two integration tests for the signature feature
- one test about adding a drawn signature
- an other one about adding a signature extracted from an image.
2025-02-18 15:24:03 +01:00
calixteman
203452c170
Merge pull request #19508 from calixteman/issue19505
[JS] Skip throwing actions
2025-02-17 22:57:14 +01:00
Calixte Denizet
8f9232202f [JS] Skip throwing actions
It fixes #19505.

We were invaliding throwing actions (in setting event.rc to false) and all the event process was stopped.
Now we're just dumping the exception in the console: the action is skipped and event.rc is not set
else the input fields aren't updated wit KeyStroke actions.
2025-02-17 21:58:20 +01:00
Calixte Denizet
3fc6b1321f [Editor] Scale the signature editor when it's too large (bug 1948741) 2025-02-17 20:20:26 +01:00
Jonas Jenwald
36979e9eb2 Fix all outstanding ESLint arrow-body-style warnings
Currently this rule is disabled in a number of spots across the code-base, and unless absolutely necessary we probably shouldn't disable linting, so let's just update the code to fix all the outstanding cases.
2025-02-17 15:45:44 +01:00
Calixte Denizet
b8993cfcc8 [Editor] Add two integration tests for the signature UI 2025-02-17 13:58:54 +01:00
Jonas Jenwald
65df1d336f Check more of the stream when looking for commands after inline image (issue 19494)
Currently we only check `followingBytes`, which turns out to be too short to find e.g. valid transform (cm) commands with decimal arguments.
2025-02-15 15:14:47 +01:00
Jonas Jenwald
33cba30bdb Search for destinations in both /Names and /Dests dictionaries (issue 19474)
Currently we only use either one of them, preferring the NameTree when it's available.
2025-02-14 15:49:05 +01:00
Jonas Jenwald
bd05b255fa [api-major] Apply the userUnit using CSS, to fix the text/annotation layers (bug 1947248)
Rather than modifying the "raw" dimensions of the page, we'll instead apply the `userUnit` as an *additional* scale-factor via CSS.

*Please note:* It's not clear to me if this solution is fully correct either, or if there's other problems with it, but it at least *appears* to work.

---

With these changes, the following CSS variables are now assumed to be available/set as necessary: `--total-scale-factor`, `--scale-factor`, `--user-unit`, `--scale-round-x`, and `--scale-round-y`.
2025-02-11 14:36:06 +01:00
calixteman
e3cca6d513
Merge pull request #19425 from calixteman/signature_save
[Editor] Add the possibility to compress/decompress the signature data in  order to store them in the logins storage in Firefox (bug 1946171)
2025-02-10 19:20:32 +01:00
Calixte Denizet
6b95095e14 Add the possibility to compress/decompress the signature data in order to store them in the logins storage in Firefox (bug 1946171) 2025-02-10 19:09:51 +01:00
Jonas Jenwald
fba5f3c237 Create the borderStyle of inferred links lazily (PR 19110 follow-up)
Given that most inferred links will overlap existing LinkAnnotations, creating a lot of unused `borderStyle` objects seem unnecessary.
Hence we can move that into the `AnnotationLayer.prototype.addLinkAnnotations` method instead, which also allows us to slightly reduce the API-surface.
2025-02-10 11:53:22 +01:00
Jonas Jenwald
86ae2ca01c
Merge pull request #19449 from Snuffleupagus/autolinking-URL-fuzzy-match
Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up)
2025-02-09 22:51:37 +01:00
Jonas Jenwald
37ef0b4a86 Ignore the URLs when checking if inferred links overlap existing LinkAnnotations (PR 19110 follow-up)
*Note:* For the issue mentioned on Matrix it'll obviously still make sense to improve the regular expression to detect more URL edge-cases.

However it occurred to me that even once that particular case is fixed there'll always be a risk that inferred links could overlap, and effectively block, the actual LinkAnnotations.
Hence this patch removes the URL comparison to ensure that overlapping inferred links will always be ignored.
2025-02-09 22:06:58 +01:00
Tim van der Meij
d88035525c
Merge pull request #19457 from timvandermeij/integration-tests-ink-isolate
Isolate the ink editor integration tests
2025-02-09 18:10:29 +01:00
calixteman
6862e84daa
Merge pull request #19437 from calixteman/signature_save_print1
[Editor] Add the ability to print and save some newly added signatures (bug 1946795)
2025-02-09 17:13:01 +01:00
Tim van der Meij
6d9ff34611
Isolate the ink editor integration tests
To avoid being able to introduce dependencies between tests, and to
bring existing dependencies to the surface, this commit makes sure that
we close the document between tests so that we can't accidentally rely
on state set by a previous test. This prevents multiple tests from
failing if one of them fails and makes debugging easier by being able to
run each test on their own independent of other tests.

This commit, combined with the previous one, is enough to make the ink
editor integration test suite pass consistently if random mode in
Jasmine is enabled, proving that the tests are fully isolated now.
2025-02-09 16:46:58 +01:00
Tim van der Meij
ced1268ec3
Remove the dependency between two ink editor integration tests
The second test of the basic operations block for the ink editor
depends on the first test to work. This becomes visible if we only run
the second test, using `fit`, which always fails with:

`ProtocolError: Waiting for selector '.annotationEditorLayer' failed:
Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting
in launch/connect calls for a higher timeout if needed.`

The problem is that the second test doesn't enable the ink editor and
relies on the first test having done that already (because we don't
close the document between tests yet). This commit fixes the issue by
unconditionally enabling the ink editor in the second test to remove the
dependency between the two tests so they both pass in isolation.
2025-02-09 16:46:58 +01:00