Commit Graph

9313 Commits

Author SHA1 Message Date
Jonas Jenwald
2b79782377 [api-minor] Add basic support for Launch actions (issue 1778, issue 3897, issue 6616)
In general we neither want, nor can, support arbitrary `Launch` actions. But in practice, all the cases we've seen so far just contains relative URLs to other PDF files. Building on PR 7689, we can thus at least support basic `Launch` actions.
2016-10-21 13:40:32 +02:00
Jonas Jenwald
7e392c0205 Merge pull request #7689 from Snuffleupagus/relative-URLs
[api-minor] Add support for relative URLs, in both annotations and the outline, by adding a `docBaseUrl` parameter to `PDFJS.getDocument` (bug 766086)
2016-10-19 22:51:09 +02:00
Jonas Jenwald
d284cfd5eb [api-minor] Add support for relative URLs, in both annotations and the outline, by adding a docBaseUrl parameter to PDFJS.getDocument (bug 766086)
Note that in `FIREFOX/MOZCENTRAL/CHROME` builds of the standard viewer the `docBaseUrl` parameter will be set by default, since in that case it makes sense to use the current URL as a base.
For the `GENERIC` viewer, or the API itself, it doesn't make sense to try and set the `docBaseUrl` by default. However, custom deployments/implementations may still find the parameter useful.
2016-10-19 22:20:24 +02:00
Jonas Jenwald
71a781ee5c Deprecate the isValidUrl utility function and replace it with createValidAbsoluteUrl/isValidProtocal functions instead, since the main URL validation is now done using the new URL constructor 2016-10-19 22:11:22 +02:00
Jonas Jenwald
42f07c6262 [api-minor] Use the new URL constructor when validating URLs in annotations and the outline, as a complement to only checking the protocol, and add a bit more validation to Catalog_parseDestDictionary
Note that this will automatically reject any relative URL.
To make the API more useful to consumers, URLs that are rejected will be available via the `unsafeUrl` property in the data object returned by `PDFPageProxy_getAnnotations`.

The patch also adds a bit more validation of the data for `Named` actions.
2016-10-19 22:11:17 +02:00
Jonas Jenwald
e64bc1fd13 Move parsing of destination dictionaries to a helper function
This not only reduces code duplication, but it also allow us to easily support the same kind of URLs we currently do for Link annotations in the Outline as well.
2016-10-18 16:14:07 +02:00
Tim van der Meij
6906623462 Merge pull request #7717 from jeenuv/display-double-click-tooltip
Explain double-click behaviour on tool tip
2016-10-18 13:52:31 +02:00
Tim van der Meij
1783f14511 Merge pull request #7732 from yurydelendik/svg-cgrp
Removes SVG this.cgrp usages.
2016-10-18 00:57:52 +02:00
Yury Delendik
1236b27993 Removes SVG this.cgrp usages. 2016-10-17 16:09:24 -05:00
Yury Delendik
273d2de6ec Merge pull request #7715 from timvandermeij/svg-groups
SVG: optimize and refactor group creation code
2016-10-17 10:10:47 -05:00
Tim van der Meij
960e344a8a Merge pull request #7730 from Snuffleupagus/jsdoc-typedef-property
Fix a couple of JSDoc `@typedef`s to use `@property` (instead of `@param`) to fix some missing documentation when running `gulp jsdoc`
2016-10-17 16:38:13 +02:00
Yury Delendik
1369997bbf Properly invoke 'gulp' in make.js and fail when it fails. 2016-10-17 08:47:05 -05:00
Yury Delendik
85db146525 Run 'firefox' and 'chromium' task in-sequences 2016-10-17 08:05:16 -05:00
Jonas Jenwald
2ce9da9b7a Fix a couple of JSDoc @typedefs to use @property (instead of @param) to fix some missing documentation when running gulp jsdoc 2016-10-17 13:04:55 +02:00
Jonas Jenwald
6678da379b Merge pull request #7728 from timvandermeij/gulp-port
Gulp: port the `all`, `extension` and `jsdoc` targets
2016-10-17 12:49:47 +02:00
Tim van der Meij
224e3a42a2 Gulp: port the all, extension and jsdoc targets
This requires the `run-sequence` dependency because Gulp does not have a
way to run sequences of tasks inside a Gulp task. Gulp 4.0 will have
support for this, but until that is released this is the recommended way
to implement it.
2016-10-16 22:17:25 +02:00
Jeenu Viswambharan
f2dcacd164 Explain double-click behaviour on tool tip
The outline toggle button has a feature where it can be double-clicked
to expand/collapse all items shown therein. Although this is described
in the FAQ, can go potentially unnoticed. This, however, being a useful
feature, advertise on the tool tip itself.

l10n translation for en-US and IDs updated.

Signed-off-by: Jeenu Viswambharan <jeenuv@gmail.com>
2016-10-16 09:22:48 +01:00
Tim van der Meij
426fc454de SVG: factor out initialization code into a private method
Each well-formed SVG image has the following structure:

SVG element
- Definitions element
- Root group
  - Other group 1
  - ...
  - Other group n

This patch factors out initialization code into a private method in such
as way that the creation of this structure is clear from the code. The
root group is the replacement for the parent group from before. We need
this group as we cannot apply the viewport transform on the SVG element
itself (this caused issues in Chrome). If other code appends groups to
the SVG image, in reality it is appending those groups to the root
group, but this detail is abstracted away by this patch.
2016-10-15 21:45:44 +02:00
Tim van der Meij
fa90573c4b SVG: optimize transform group creation
This patch ensures that we only create transformation groups when it is
actually required and that we re-use transform groups as much as possible.
It reduces the number of transform groups for the Tracemonkey paper from
2790 to 1271, thereby making the DOM much lighter and rendering/scrolling
smoother. Moreover, it simplifies the code and prevents duplication.

Finally, we issue a warning when an unimplemented graphic state is
encountered. Before, this was ignored silently, making debugging harder.
2016-10-15 21:43:12 +02:00
Tim van der Meij
de6c92a96d Examples: improve SVG viewer
This patch:

- resolves a warning in the console about missing character encoding;
- makes the viewer use the same background color and PDF file as the
  regular viewer;
- simplifies the example to bring it more in line with the other
  examples.
2016-10-15 21:08:24 +02:00
Tim van der Meij
2e20000b71 Merge pull request #7727 from Snuffleupagus/parser-stream-decodeParms
Let `Parser_makeFilter` pass in the `DecodeParms` data to various image `Stream`s, instead of re-fetching it in various `[...]Stream.prototype.ensureBuffer` methods
2016-10-15 20:04:17 +02:00
Yury Delendik
ea5949f1fd Merge pull request #7668 from Snuffleupagus/issue-7665
Prevent an infinite loop in `XRef_fetchUncompressed` for encrypted PDF files with indirect objects in the /Encrypt dictionary (issue 7665)
2016-10-15 10:52:08 -05:00
Jonas Jenwald
f209030b99 Merge pull request #7726 from Snuffleupagus/remove-remaining-preprocessor-statement-core-fonts
Remove a remaining old-style preprocessor from `src/core/fonts.js` (PR 7322 follow-up)
2016-10-15 13:46:23 +02:00
Jonas Jenwald
c8f83d6487 Let Parser_makeFilter pass in the DecodeParms data to various image Streams, instead of re-fetching it in various [...]Stream.prototype.ensureBuffer methods
In `Parser_filter` the `DecodeParms` data is fetched and passed to `Parser_makeFilter`, where we also make sure that a `Ref` is resolved to a direct object.
We can thus pass this along to the various image `Stream` constructors, to avoid the current situation where we lookup/resolve data that is already available.
Note also that we currently do *not* handle the case where `DecodeParms` is an Array entirely correct in the various image `Stream`s, and this patch fixes that for free.
2016-10-15 12:09:51 +02:00
Jonas Jenwald
1da59bec9b Remove a remaining old-style preprocessor from src/core/fonts.js (PR 7322 follow-up)
Note that this code was added *after* PR 7322 was opened, which thus explains why it was missed during rebasing.
2016-10-15 11:33:09 +02:00
Jonas Jenwald
c1a34ffbcd Merge pull request #7322 from yurydelendik/preproc2
Remove JS preprocessor code from the web/ and src/ files
2016-10-14 23:35:17 +02:00
Yury Delendik
0576c9c6c6 Replaces all preprocessor directives with PDFJSDev calls. 2016-10-14 10:57:53 -05:00
Yury Delendik
bf52ff156d Adds esprima-based preprocessor. 2016-10-14 08:33:22 -05:00
Jonas Jenwald
bc3bcebde2 Merge pull request #7722 from Rob--W/grab-to-pan-cssom-and-cleanup
Update to latest grab-to-pan version
2016-10-14 09:58:24 +02:00
Rob Wu
c7c6bf1ae8 Update to latest grab-to-pan version 2016-10-14 00:55:58 +02:00
Tim van der Meij
c457e6015d Merge pull request #7714 from cemerick/fix-non-numeric-TJ
Fix getTextContent evaluation to only apply TJ horizontal offsets using numeric items/args
2016-10-13 16:03:49 +02:00
Chas Emerick
85c52f1fd6 Fix getTextContent evaluation to only apply TJ horizontal offsets using numeric items/args
While the array argument to TJ should only contain strings and numbers, other
unfortunate items are found in PDFs in the wild, e.g.:

[(Grandes) 0.0 Tc
-250.0 (Client\350les,) 0.0 Tc
-250.0 (Financements) 0.0 Tc
-250.0 (et) 0.0 Tc
-250.0 (March\351s) ] TJ

getOperatorList already properly ignores any non-string, non-numeric values in
TJ arrays; without this patch to getTextContent, returned text items can have
NaN widths due to calculations being applied to those non-numeric values.
2016-10-13 08:08:31 -04:00
Tim van der Meij
8c5b925547 Merge pull request #7514 from Snuffleupagus/viewer-abort-rendering-on-close
Ensure that we cancel any pending rendering operations when the viewer is closed (issue 7274)
2016-10-11 23:48:51 +02:00
Jonas Jenwald
885ba83624 Add the number of textDivs to the textlayerrendered event, to avoid having to manually get that information in the event handler 2016-10-11 22:36:02 +02:00
Jonas Jenwald
3904be8889 Ensure that we cancel any pending textLayer rendering operations when the viewer is closed (issue 7274) 2016-10-11 22:01:22 +02:00
Jonas Jenwald
a824c6c4f6 Ensure that any pending rendering operations in PDFViewer/PDFThumbnailViewer are cancelled when the viewer is closed 2016-10-11 22:01:22 +02:00
Tim van der Meij
fb5aa58008 Merge pull request #7697 from yurydelendik/print-v2
Refactoring of printing code and mozPrintCallback polyfill
2016-10-11 21:22:07 +02:00
Yury Delendik
1a056caf88 Localization of the print dialog. 2016-10-11 10:08:13 -05:00
Yury Delendik
c09f634bb6 Removes mozPrintCallback polyfill, converts canvas to PNG. 2016-10-11 10:08:13 -05:00
Jonas Jenwald
d7148735ba Update l10n files 2016-10-09 12:11:53 +02:00
Yury Delendik
24a7a58da7 Moves mozPrintCallback specific code to firefox_printservice.js 2016-10-08 07:33:07 -05:00
Tim van der Meij
f8bd3d4473 Merge pull request #7694 from yurydelendik/print-ff
Disables Font Loading API for Firefox.
2016-10-06 23:17:12 +02:00
Yury Delendik
e336604ef1 Disables Font Loading API for Firefox. 2016-10-06 09:30:18 -05:00
Yury Delendik
e48f388d24 Merge pull request #7677 from yurydelendik/print
Bug 1302069 - Printing canvases at PDF document size.
2016-10-06 08:16:19 -05:00
Yury Delendik
29947b5a57 Printing canvases at PDF document size. 2016-10-06 07:51:45 -05:00
Tim van der Meij
9b3a91f365 Merge pull request #7671 from timvandermeij/interactive-forms-choice-fields
Interactive forms: render choice widget annotations
2016-10-05 23:27:45 +02:00
Tim van der Meij
f85f3243b1 Choice widget annotations: unit and reference testing 2016-10-05 21:25:29 +02:00
Tim van der Meij
d5d9f362aa Choice widget annotations: core and display layer implementation 2016-10-05 21:25:29 +02:00
Yury Delendik
7b2a9ee4e0 Merge pull request #7670 from Snuffleupagus/Parser_makeFilter-maybeLength
Only skip parsing a stream in `Parser_makeFilter` when we know for sure that it is empty (PR 6372 follow-up)
2016-10-05 10:38:12 -05:00
Yury Delendik
b4a90121f0 Merge pull request #7692 from yurydelendik/v1.6.210
Release of 1.6.210
2016-10-04 12:21:07 -05:00