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

19191 commits

Author SHA1 Message Date
Tim van der Meij
b557fba118
Merge pull request #18217 from Snuffleupagus/inline-finishRendering
Inline the `#finishRendering` helper in `TextLayerBuilder.prototype.render`
2024-06-07 14:16:07 +02:00
Tim van der Meij
593ce96834
Merge pull request #18216 from Snuffleupagus/download-data
Change `DownloadManager.download` to use Uint8Array-data
2024-06-07 14:14:48 +02:00
Jonas Jenwald
f7cbd7d16b Inline the #finishRendering helper in TextLayerBuilder.prototype.render
This helper method is simpler/shorter than it originally was[1] and with recent refactoring so is the `render`-method, hence we can just inline this code now.

---
[1] It used to e.g. dispatch the "textlayerrendered" event.
2024-06-07 13:32:28 +02:00
Jonas Jenwald
66e189c9aa Change DownloadManager.download to use Uint8Array-data
Part of this code is really old and pre-dates general availability of things such as `Blob` and `URL.createObjectURL`. To avoid having to duplicate the Blob-creation in the viewer, we can move this into `DownloadManager.download` instead.

Also, remove a couple of unnecessary `await` statements since the methods in question are synchronous.
2024-06-07 13:23:02 +02:00
calixteman
6a71f692bf
Merge pull request #18205 from calixteman/openjpeg_bsd2
Change openjpeg.js license from Apache 2 to BSD 2-clause
2024-06-04 21:27:35 +02:00
Calixte Denizet
e7749443a7 Change openjpeg.js license from Apache 2 to BSD 2-clause 2024-06-04 21:22:48 +02:00
calixteman
21e622769b
Merge pull request #18204 from calixteman/issue16782
Fix decoding of JPX images having an alpha channel
2024-06-03 21:21:52 +02:00
Calixte Denizet
196affd8e0 Fix decoding of JPX images having an alpha channel
When an image has a non-zero SMaskInData it means that the image
has an alpha channel.
With JPX images, the colorspace isn't required (by spec) so when we
don't have it, the JPX decoder will handle the conversion in RGBA
format.
2024-06-03 20:08:11 +02:00
calixteman
5c51d56223
Merge pull request #18167 from calixteman/decompress_image
Decompress when it's possible images in using DecompressionStream
2024-06-02 16:08:19 +02:00
Calixte Denizet
9654ad570a Decompress when it's possible images in using DecompressionStream
Getting images is already asynchronous, so we can use this opportunity
to use DecompressStream (which is async too) to decompress images.
2024-06-02 14:00:05 +02:00
Tim van der Meij
53dfb5a6ba
Merge pull request #18197 from timvandermeij/gulp-5
Upgrade `gulp` to version 5.0.0
2024-06-01 16:16:31 +02:00
calixteman
309d940c3a
Merge pull request #18189 from calixteman/bug1895050
Switch to page-scrolling mode when the pdf has more than 10000 pages (bug 1895050)
2024-05-31 16:03:31 +02:00
Calixte Denizet
018649f13b Switch to page-scrolling mode when the pdf has more than 10000 pages (bug 1895050) 2024-05-31 15:35:26 +02:00
Tim van der Meij
d25b52702a
Upgrade gulp to version 5.0.0
This is a major version bump, and the changelog at
https://github.com/gulpjs/gulp/releases/tag/v5.0.0 indicates one
breaking change that impacts us, namely that streams are now by default
interpreted/transformed to UTF-8 encoding. This breaks `gulp.src` calls
that work on binary files such as images or CMaps, but is fortunately
easy to fix for us by disabling re-encoding for all `gulp.src` calls
(see https://github.com/gulpjs/gulp/issues/2764#issuecomment-2063415792
for more information). This restores the previous behavior of copying
the files as-is without Gulp performing any transformations to it, which
is what we want because Gulp is only used for bundling and we make sure
that the source files have the right encoding.
2024-05-31 14:59:11 +02:00
calixteman
4d9c25a41a
Merge pull request #18193 from calixteman/rm_observer
Disconnect the resize observer and remove scroll listener when unbinding window events
2024-05-30 22:51:05 +02:00
Calixte Denizet
4430b6b703 Disconnect the resize observer and remove scroll listener when unbinding window events 2024-05-30 22:09:52 +02:00
Tim van der Meij
ea34e5ccf6
Merge pull request #18192 from calixteman/bump_4.4
Bump library version to 4.4
2024-05-30 19:05:56 +02:00
Calixte Denizet
648a2d8057 Bump library version to 4.4 2024-05-30 18:56:13 +02:00
calixteman
fdb3617e0f
Merge pull request #18163 from calixteman/simplify_list_points
[api-minor] Simplify how the list of points are structured
2024-05-30 18:25:50 +02:00
Tim van der Meij
0ac4b34c66
Merge pull request #18183 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-05-30 15:46:07 +02:00
Calixte Denizet
6fa98ac99f [api-minor] Simplify how the list of points are structured
Instead of sending to the main thread an array of Objects for a list of points (or quadpoints),
we'll send just a basic float buffer.
It should slightly improve performances (especially when cloning the data) and use slightly less memory.
2024-05-30 15:36:15 +02:00
Tim van der Meij
ea0d2126ea
Update translations to the most recent versions 2024-05-28 19:25:46 +02:00
Tim van der Meij
85c79422cf
Update dependencies to the most recent versions 2024-05-28 19:24:24 +02:00
Tim van der Meij
24e12d515d
Merge pull request #18182 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2024-05-28 18:48:09 +02:00
Tim van der Meij
fcea7e7b4b
Bump the stable version in pdfjs.config 2024-05-28 18:44:56 +02:00
Jonas Jenwald
0cec644372
Merge pull request #18179 from nicolo-ribaudo/zooming-utilities
[api-minor] Simplify API to implement zoom in custom viewers
2024-05-28 16:39:06 +02:00
Tim van der Meij
027ada81a7
Merge pull request #18170 from Snuffleupagus/TextLayerBuilder-rm-setTextContentSource
[api-minor] Remove the `setTextContentSource` method in `TextLayerBuilder` (PR 18104 follow-up)
2024-05-28 16:38:52 +02:00
Nicolò Ribaudo
b7933d8750
Add origin parameter to updateScale
This parameter allows defining which point should remain
fixed while scaling the document. It can be used, for example,
to implement "zoom around the cursor" or "zoom around
pinch center".

The logic was previously implemented in `web/app.js`, but
moving it to the viewer scaling utilities themselves makes it
easier to implement similar zooming functionalities in
other embedders.
2024-05-28 16:19:47 +02:00
Tim van der Meij
ee545930ea
Merge pull request #18171 from Snuffleupagus/move-pendingTextLayers
Don't register a pending `TextLayer` until `render` is invoked (PR 18104 follow-up)
2024-05-28 15:37:51 +02:00
Nicolò Ribaudo
161c7045f6
Unify increaseScale/decreaseScale logic as updateScale
`updateScale` receives a `drawingDelay`, a `scaleFactor` and/or a number of `steps`.
If `scaleFactor` is a positive number different from `1` the current scale is multiplied by
that number. Otherwise, if `steps` if a positive integer the current scale is multiplied by
`DEFAULT_SCALE_DELTA` `steps` times. Finally, if `steps` is a negative integer, the
current scale is divided by `DEFAULT_SCALE_DELTA` `abs(steps)` times.
2024-05-28 14:02:39 +02:00
Tim van der Meij
aac738c805
Merge pull request #18169 from Snuffleupagus/worker-shorter-code
Slightly shorten some worker-thread code
2024-05-28 13:36:05 +02:00
Tim van der Meij
401a1d4a34
Merge pull request #18161 from Snuffleupagus/types-ES2022
Target ES2022 when building the TypeScript definitions (issue 17932)
2024-05-28 13:28:22 +02:00
calixteman
95a7de9f98
Merge pull request #18174 from calixteman/make_dialog_css
Move the dialog css stuff in its own file
2024-05-28 11:26:49 +02:00
Calixte Denizet
697255d7cc Move the dialog css stuff in its own file
In order to share common parts between different dialogs, this patch
aims to slightly refactor the css in making it more generic.
This way it'll simplify adding a new dialog (we want to add a new one when
leaving an unsaved document).
2024-05-27 22:25:18 +02:00
calixteman
4bdc75f18d
Merge pull request #18165 from calixteman/integrationtest_switch_foo
Simplify the integration test in adding a function to turn on/off an editing tool
2024-05-27 12:00:25 +02:00
Calixte Denizet
b6b02ccff6 Simplify the integration test in adding a function to turn on/off an editing tool 2024-05-27 11:33:52 +02:00
Jonas Jenwald
f2e7eee00e Don't register a pending TextLayer until render is invoked (PR 18104 follow-up)
After the re-factoring in PR 18104 there's now a *theoretical* risk that a pending `TextLayer` is never removed, which we can avoid by not registering it until `render` is invoked.
Note that this doesn't affect the viewer or tests, but if a third-party user calls `new TextLayer(...)` without a following call of either the `render`- or `cancel`-method we'd block global clean-up without this patch.
2024-05-26 18:38:40 +02:00
Jonas Jenwald
303e793264 Introduce a helper method, in PDFPageView, for dispatching "...layerrendered" events
Currently we repeat virtually the same, with the exception of the name, event dispatching code four times for the different viewer layers.
2024-05-26 12:44:06 +02:00
Jonas Jenwald
db86f8132e [api-minor] Remove the setTextContentSource method in TextLayerBuilder (PR 18104 follow-up)
The `setTextContentSource` functionality is very old code, and was introduced years ago together with streaming of textContent.
By moving the `streamTextContent`-call into the `TextLayerBuilder` class we collect more functionality in one place and slightly reduce the amount of code needed.
2024-05-26 12:43:59 +02:00
Jonas Jenwald
27436d52b2 Reduce indentation when parsing new annotations in getOperatorList
This code has, over the years, become more complex and less indentation generally helps readability.
2024-05-25 12:00:44 +02:00
Jonas Jenwald
ce52ce063e Change parsingType3Font to a getter (PR 14448 follow-up)
We can easily "compute" `parsingType3Font` from the `type3FontRefs`-value, and thus avoid having to separately track two related properties.
2024-05-25 10:46:12 +02:00
Jonas Jenwald
c349ac3a5d Skip the temporary variable when calling #findStreamLength (PR 18125 follow-up) 2024-05-25 10:38:32 +02:00
Jonas Jenwald
17e09e5478
Merge pull request #18159 from Snuffleupagus/loadingParams-test
Improve the `loadingParams` functionality in the API
2024-05-24 23:21:24 +02:00
Jonas Jenwald
6460e9ebcf
Merge pull request #18160 from Snuffleupagus/file-layout-overview
Update the "File Layout Overview" docs
2024-05-24 22:31:30 +02:00
Jonas Jenwald
b78480a375
Merge pull request #18166 from Snuffleupagus/bug-1898802
Prevent XRef errors from breaking font loading (bug 1898802)
2024-05-24 22:29:21 +02:00
Jonas Jenwald
cfcb700ecc Prevent XRef errors from breaking font loading (bug 1898802)
Note that the referenced file is trivially corrupt, since it contains *two* PDF documents placed in the same file which doesn't make sense (and isn't how a PDF document should be updated).
However it's still a good idea to ensure that `loadFont` is able to handle errors when resolving References, since that allows us to invoke the existing fallback font handling.
2024-05-24 21:37:35 +02:00
Jonas Jenwald
78deb798e3 Target ES2022 when building the TypeScript definitions (issue 17932)
This should avoid the latest JS features appearing in the TypeScript definitions, and given the currently supported browsers/environments (in PDF.js) we shouldn't need to target an even older ES-version.
2024-05-24 12:14:58 +02:00
Jonas Jenwald
03601f99d8 Update the "File Layout Overview" docs
Apparently we forgot to update this in the version 4 release, so better late than never I suppose.
 - Use `.mjs` extensions where appropriate.
 - Remove mention of the `debugger`-functionality, since that's not really relevant to users.
 - Unify the whitespace handling to use spaces consistently.
2024-05-24 11:42:06 +02:00
calixteman
18a7bd60f7
Merge pull request #18156 from calixteman/bug1882613
[GeckoView] Don't use the system fonts (bug 1882613)
2024-05-24 09:56:38 +02:00
Calixte Denizet
adb2bb5af8 [GeckoView] Don't use the system fonts (bug 1882613)
On Android there's almost no chance we find a substitution font so
just use one of the font embedded in pdf.js.
2024-05-24 09:30:22 +02:00