Commit Graph

11588 Commits

Author SHA1 Message Date
Jonas Jenwald
468bd829f2 Add passive: false to the wheel event listener, to work-around broken default behaviour in Chrome 73 and above (issue 10761)
Let's try this, since it doesn't appear to break scrolling/zooming in IE11.
2019-04-24 17:37:25 +02:00
Tim van der Meij
762c58e0fc
Merge pull request #10738 from Snuffleupagus/ViewerPreferences-api
[api-minor] Add support for ViewerPreferences in the API (issue 10736)
2019-04-20 18:39:32 +02:00
Tim van der Meij
7804bf8349
Merge pull request #10754 from Snuffleupagus/idFactory-getDocId
Add a `getDocId` method to the `idFactory`, in `Page` instances, to avoid passing around `PDFManager` instances unnecessarily (PR 7941 follow-up)
2019-04-20 18:12:56 +02:00
Jonas Jenwald
34952b732e Add a getDocId method to the idFactory, in Page instances, to avoid passing around PDFManager instances unnecessarily (PR 7941 follow-up)
This way we can avoid manually building a "document id" in multiple places in `evaluator.js`, and it also let's us avoid passing in an otherwise unnecessary `PDFManager` instance when creating a `PartialEvaluator`.
2019-04-20 13:11:17 +02:00
Tim van der Meij
55d9b35d37
Merge pull request #10727 from Snuffleupagus/type3-image-resources
Support (rare) Type3 fonts which contains image resources (issue 10717)
2019-04-18 23:07:26 +02:00
Mehdi Vasigh
18b1d636a0 Add links to PDF.js homepage and API reference in README.md 2019-04-17 23:37:37 +02:00
Tim van der Meij
48f100201e
Merge pull request #10742 from Snuffleupagus/firefox-transport-disableStream-progress
[Firefox] Avoid displaying the indeterminate loadingBar when `disableStream=true` is set (PR 10714 follow-up)
2019-04-17 00:00:06 +02:00
Jonas Jenwald
5e9b606e7b [Firefox] Avoid displaying the indeterminate loadingBar when disableStream=true is set (PR 10714 follow-up)
While PR 10714 did address the `disableRange=true` case, it also managed to "break" the `disableStream=true` case instead since the indeterminate loadingBar is now displayed when it shouldn't; sorry about that!
The solution is simple enough though, don't attempt to fallback to `_fullRequestReader.onProgress` when handling "incomplete" loading information.
2019-04-16 15:35:42 +02:00
Jonas Jenwald
311bac3ebb [api-minor] Add support for ViewerPreferences in the API (issue 10736)
Please see the specification, https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#M11.9.12864.1Heading.71.Viewer.Preferences

Furthermore, note that this patch *only* adds API support and unit-tests but does not attempt to integrate e.g. the `ViewerPreferences -> Direction` property into the viewer (which would be necessary to address issue 10736).
The reason for this is that it's not entirely clear to me exactly if/how that could be implemented; e.g. would it be as simple as setting the `dir` attribute on the `viewerContainer` DOM element, or will it be more complicated?
There's also the question of how the `ViewerPreferences -> Direction` value interacts with the `PageMode`, and this will generally require a fair bit of manual testing. Since the direction of the *entire* viewer depends on the browser locale, there's also a somewhat open question regarding what default value to use for different locales.
Finally, if the viewer supports `ViewerPreferences -> Direction` then I'm assuming that it will be necessary to allow users to override the default value, which will require (most likely) new `SecondaryToolbar` buttons and icons for those etc.

Hence this patch only lays the necessary foundation for eventually addressing issue 10736, but defers the actual implementation until later. (Time permitting, I'll try to look into the viewer part later.)
2019-04-14 14:20:52 +02:00
Tim van der Meij
8bbae79832
Merge pull request #10735 from timvandermeij/freetext-annotation
Implement free text annotations
2019-04-13 19:47:46 +02:00
Tim van der Meij
ae2a4dc3dd
Implement free text annotations 2019-04-13 18:45:22 +02:00
Tim van der Meij
62dc431af6
Merge pull request #10733 from timvandermeij/updates
Update translations and packages
2019-04-13 18:28:15 +02:00
Jonas Jenwald
be604bd195 Support (rare) Type3 fonts which contains image resources (issue 10717)
The Type3 font type is not commonly used in PDF documents, as can be seen from telemetry data such as: https://telemetry.mozilla.org/new-pipeline/dist.html#!cumulative=0&end_date=2019-04-09&include_spill=0&keys=__none__!__none__!__none__&max_channel_version=nightly%252F68&measure=PDF_VIEWER_FONT_TYPES&min_channel_version=nightly%252F57&processType=*&product=Firefox&sanitize=1&sort_by_value=0&sort_keys=submissions&start_date=2019-03-18&table=0&trim=1&use_submission_date=0 (see also https://github.com/mozilla/pdf.js/wiki/Enumeration-Assignments-for-the-Telemetry-Histograms#pdf_viewer_font_types).

Type3 fonts containing image resources are *very* rare in practice, usually they only contain path rendering operators, but as the issue shows they unfortunately do exist.
Currently these Type3-related image resources are not handled in any special way, and given that fonts are document rather than page specific rendering breaks since the image resources are thus not available to the *entire* document.
Fortunately fixing this isn't too difficult, but it does require adding a couple of Type3-specific code-paths to the `PartialEvaluator`. In order to keep the implementation simple, particularily on the main-thread, these Type3 image resources are completely decoded on the worker-thread to avoid adding too many special cases. This should not cause any issues, only marginally less efficient code, but given how rare this kind of Type3 font is adding premature optimizations didn't seem at all warranted at this point.
2019-04-13 18:27:50 +02:00
Tim van der Meij
e113516a03
Update packages 2019-04-13 17:25:41 +02:00
Tim van der Meij
b0de15e855
Update translations 2019-04-13 17:23:33 +02:00
Tim van der Meij
17de90b88a
Merge pull request #10694 from Snuffleupagus/main-thread-progressiveDataLength
Avoid dispatching range requests to fetch PDF data that's already loaded with streaming (PR 10675 follow-up)
2019-04-13 17:15:01 +02:00
Tim van der Meij
2d0c38d626
Merge pull request #10696 from Snuffleupagus/makeSubStream-ensureByte
Update `ChunkedStream.makeSubStream` to actually check if (some) data exists when the `length` parameter is undefined
2019-04-13 17:12:20 +02:00
Jonas Jenwald
a7273c8efe Avoid dispatching range requests to fetch PDF data that's already loaded with streaming (PR 10675 follow-up)
*Please note:* This patch purposely ignores `src/display/network.js`, since its support for progressive reading depends on the non-standard `moz-chunked-arraybuffer` responseType which is currently in the process of being removed.
2019-04-13 00:26:13 +02:00
Tim van der Meij
8dc2d21931
Merge pull request #10728 from vlastimilmaca/annot-markup-class
Annotations - _preparePopup method replaced with MarkupAnnotation
2019-04-13 00:15:28 +02:00
Vlastimil Máca
d96267c30c Annotations - _preparePopup method replaced with MarkupAnnotation base class. This is just refactoring, so it shouldn't break anything. It should move annotation API closer to PDF spec and enable future expansion. 2019-04-12 11:24:21 +02:00
Tim van der Meij
74561f58b5
Merge pull request #10723 from timvandermeij/caret-annotation
Implement caret annotations
2019-04-11 00:03:21 +02:00
Tim van der Meij
1340c59038
Merge pull request #10725 from Snuffleupagus/CONTRIBUTING-l10n
Attempt to clarify the `l10n` section of `CONTRIBUTING.md`
2019-04-10 23:35:49 +02:00
Jonas Jenwald
8d781b28d7 Attempt to clarify the l10n section of CONTRIBUTING.md
The existing wording is perhaps not as clear as it could be, with regards to how the translations are actually managed.
2019-04-10 11:33:25 +02:00
Tim van der Meij
4055d0a302
Implement caret annotations
The file `test/pdfs/annotation-caret-ink.pdf` is already available in
the repository as a reference test for this since I supplied it for
another patch that implemented ink annotations.
2019-04-09 23:39:56 +02:00
Tim van der Meij
725a695976
Merge pull request #10715 from mukulmishra18/fetch-stream-spec
Add test for fetch_stream
2019-04-07 14:26:17 +02:00
Mukul Mishra
02e46d22d2 Add fetch stream spec 2019-04-07 13:14:03 +02:00
Tim van der Meij
ce62373db3
Merge pull request #10674 from timvandermeij/svg-backend-es6
Convert `src/display/svg.js` to ES6 syntax and implement `setRenderingIntent` and `setFlatness` for the SVG backend
2019-04-06 17:15:14 +02:00
Tim van der Meij
5a03b1c0d7
Optimize convertOpList in svg.js by computing the operator ID mapping only once
There is no need to recompute this for every operator list we encounter.
2019-04-06 16:57:31 +02:00
Tim van der Meij
2b18e5a355
Implement setRenderingIntent and setFlatness for the SVG backend
This mirrors the canvas implementation where we ignore these operators.
This avoids console spam regarding unimplemented operators we're not
interested in.

For the Tracemonkey paper, we're now down to one warning about tiling
patterns which is in fact a valid one.
2019-04-06 16:57:30 +02:00
Tim van der Meij
47d3620d5a
Convert src/display/svg.js to ES6 syntax
In particular, this should reduce intermediate string creation by using
template strings and reduce variable lookup times by removing unneeded
variables and caching `this.current` in more places.
2019-04-06 16:57:30 +02:00
Tim van der Meij
2a9d195a43
Merge pull request #10714 from Snuffleupagus/firefox-transport-stream-progress
[Firefox] Ensure that loading progress is reported, and the loadingBar updated, when `disableRange=true` is set
2019-04-06 16:40:40 +02:00
Jonas Jenwald
f0a28b3c0d [Firefox] Ensure that loading progress is reported, and the loadingBar updated, when disableRange=true is set
With PR 10675 having fixed the completely broken `disableRange=true` setting in the Firefox version of PDF.js, I couldn't help but noticing that loading progress is never reported properly in that case.
Currently loading progress is only reported for the `rangeProgress` chrome-event, which obviously isn't dispatched with `disableRange=true` set. However, the `progressiveRead` chrome-event includes loading progress as well, but this information isn't being used in any way.
Furthermore, the `PDFDataRangeTransport.onDataProgress` method wasn't able to handle "complete" loading information, and neither was `PDFDataTransportStream._onProgress` since that method would only ever attempt to report it through a RangeReader (which won't exist when `disableRange=true` is set).
2019-04-06 12:53:33 +02:00
Tim van der Meij
b161050df4
Merge pull request #10709 from Snuffleupagus/pageLayout
[api-minor] Add basic support for PageLayout in the API and the viewer
2019-04-05 23:07:32 +02:00
Tim van der Meij
8c8738ea47
Merge pull request #10678 from Snuffleupagus/rm-moz-chunked-arraybuffer
Remove `moz-chunked-arraybuffer` support, and related code, from `src/display/network.js`
2019-04-05 22:52:28 +02:00
Jonas Jenwald
7a999d1d67 [api-minor] Add basic support for PageLayout in the API and the viewer
Please see the specification, https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf#G6.2393749, and refer to the inline comments for additional details.
2019-04-05 11:32:01 +02:00
Tim van der Meij
57abddc9ca
Merge pull request #10713 from Snuffleupagus/rm-JSDoc-annotation
Remove `src/core/annotation.js` from the `gulp jsdoc` build target
2019-04-04 23:15:02 +02:00
Tim van der Meij
072c5864fb
Merge pull request #10675 from Snuffleupagus/PDFDataTransportStream-disableRange
[Firefox regression] Fix `disableRange=true` bug in `PDFDataTransportStream`
2019-04-04 23:07:45 +02:00
Jonas Jenwald
f666395c24 Remove src/core/annotation.js from the gulp jsdoc build target
Note how at https://mozilla.github.io/pdf.js/api/ it's being described as API docs, however `src/core/annotation.js` is not part of the public API.
Furthermore, given that the code residing in the `src/core/` folder is run in a worker-thread, it's not even accessible on the main-thread (since `postMessage` is being used to transfer the data).
Hence the different API methods simply returns a "proxy" to the underlying data, but not actually the same objects and data structures as in the worker-thread itself; thus it doesn't make a whole lot of sense to expose this in API docs as far as I'm concerned.

Finally, the patch fixes a small JSDoc related typo in `src/display/api.js` when referring to the `TextStyle` typedef.
2019-04-04 18:03:08 +02:00
Tim van der Meij
5498b19108
Merge pull request #10706 from Snuffleupagus/domstubs-hasChildNodes
Add missing `hasChildNodes` polyfill to `domstubs.js` (PR 10022 follow-up)
2019-04-01 23:57:58 +02:00
Jonas Jenwald
9c3024fe7e Add missing hasChildNodes polyfill to domstubs.js (PR 10022 follow-up) 2019-04-01 23:23:50 +02:00
Jonas Jenwald
b40e6723be Remove moz-chunked-arraybuffer support, and related code, from src/display/network.js
The `moz-chunked-arraybuffer` responseType is a non-standard property, which has been subsumed by the Fetch API, and it's in the process of being removed from Firefox; please see https://bugzilla.mozilla.org/show_bug.cgi?id=1120171 and https://bugzilla.mozilla.org/show_bug.cgi?id=1411865

*Please note:* Rather than waiting for both `Fetch` *and* `ReadableStream` to be available in e.g. a Firefox ESR version (which is probably going to be 68 at the earliest), let's just decide that PDF.js release `2.1.266` will be the last one with `moz-chunked-arraybuffer` support and land this patch (since nothing should outright break without it anyway).
2019-04-01 20:48:51 +02:00
Tim van der Meij
47f208df36
Merge pull request #10698 from timvandermeij/updates
Update translations/packages and include the code of conduct for `pdfjs-dist` too
2019-03-30 19:09:36 +01:00
Tim van der Meij
a020434b26
Include the code of conduct for pdfjs-dist too 2019-03-30 19:00:57 +01:00
Tim van der Meij
7cfa05078d
Update packages 2019-03-30 18:59:52 +01:00
Tim van der Meij
4653dc196b
Update translations 2019-03-30 18:56:17 +01:00
Jonas Jenwald
c6ddbd55e2 Add a progressiveDataLength fast-path to ChunkedStream.ensureByte
This is *similar* to the existing check using in `ChunkedStream.ensureRange`.
2019-03-29 20:00:28 +01:00
Jonas Jenwald
49e8a270c4 Update ChunkedStream.makeSubStream to actually check if (some) data exists when the length parameter is undefined
Note how `XRef.fetchUncompressed`, which is used *a lot* for most PDF documents, is calling the `makeSubStream` method without providing a `length` argument.
In practice this results in the `makeSubStream` method, on the `ChunkedStream` instance, calling the `ensureRange` method with `NaN` as the end position,  thus resulting in no data being requested despite it possibly being necessary.

This may be quite bad, since in this particular case it will lead to a new `ChunkedStream` being created *and* also a new `Parser`/`Lexer` instance. Given that it's quite possible that even the very first `Parser.getObj` call could throw `MissingDataException`, this could thus lead to wasted time/resources (since re-parsing is necessary once the data finally arrives).

You obviously need to be very careful to not have `ChunkedStream.makeSubStream` accidentally requesting the *entire* file, hence its `this.end` property is of no use here, but it should be possible to at least check that the `start` of the data is present before any potentially expensive parsing occurs.
2019-03-29 17:20:31 +01:00
Tim van der Meij
b4c3b94592
Merge pull request #6606 from Rob--W/pattern-scaling
Improve performance and correctness of Tiling Patterns
2019-03-29 00:01:38 +01:00
Tim van der Meij
89294aaa3f
Merge pull request #10692 from Mozilla-GitHub-Standards/master
Add Mozilla Code of Conduct
2019-03-28 23:29:50 +01:00
Mozilla-GitHub-Standards
800de61422 Add Mozilla Code of Conduct file
Fixes #10691.

_(Message COC002)_
2019-03-27 21:00:01 -07:00