2012-09-01 07:48:21 +09:00
|
|
|
|
/* Copyright 2012 Mozilla Foundation
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
2011-10-26 10:18:22 +09:00
|
|
|
|
|
2022-09-25 23:18:11 +09:00
|
|
|
|
// Skip compatibility checks for modern builds and if we already ran the module.
|
|
|
|
|
if (
|
|
|
|
|
typeof PDFJSDev !== "undefined" &&
|
|
|
|
|
!PDFJSDev.test("SKIP_BABEL") &&
|
|
|
|
|
!globalThis._pdfjsCompatibilityChecked
|
|
|
|
|
) {
|
|
|
|
|
globalThis._pdfjsCompatibilityChecked = true;
|
|
|
|
|
require("./compatibility.js");
|
|
|
|
|
}
|
2013-08-13 02:48:06 +09:00
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
|
|
|
|
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
2013-08-13 02:48:06 +09:00
|
|
|
|
|
2023-03-04 19:22:59 +09:00
|
|
|
|
const MAX_IMAGE_SIZE_TO_CACHE = 10e6; // Ten megabytes.
|
|
|
|
|
|
2022-05-19 22:12:28 +09:00
|
|
|
|
// Represent the percentage of the height of a single-line field over
|
|
|
|
|
// the font size. Acrobat seems to use this value.
|
|
|
|
|
const LINE_FACTOR = 1.35;
|
2022-06-01 22:42:46 +09:00
|
|
|
|
const LINE_DESCENT_FACTOR = 0.35;
|
2022-10-19 00:07:47 +09:00
|
|
|
|
const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
|
2022-05-19 22:12:28 +09:00
|
|
|
|
|
[Regression] Re-factor the *internal* `includeAnnotationStorage` handling, since it's currently subtly wrong
*This patch is very similar to the recently fixed `renderInteractiveForms`-options, see PR 13867.*
As far as I can tell, this *subtle* bug has existed ever since `AnnotationStorage`-support was first added in PR 12106 (a little over a year ago).
The value of the `includeAnnotationStorage`-option, as passed to the `PDFPageProxy.render` method, will (potentially) affect the size/content of the operatorList that's returned from the worker (for documents with forms).
Given that operatorLists will generally, unless they contain huge images, be cached in the API, repeated `PDFPageProxy.render` calls where the form-data has been changed by the user in between, can thus *wrongly* return a cached operatorList.
In the viewer we're only using the `includeAnnotationStorage`-option when printing, which is probably why this has gone unnoticed for so long. Note that we, for performance reasons, don't cache printing-operatorLists in the API.
However, there's nothing stopping an API-user from using the `includeAnnotationStorage`-option during "normal" rendering, which could thus result in *subtle* (and difficult to understand) rendering bugs.
In order to handle this, we need to know if the `AnnotationStorage`-instance has been updated since the last `PDFPageProxy.render` call. The most "correct" solution would obviously be to create a hash of the `AnnotationStorage` contents, however that would require adding a bunch of code, complexity, and runtime overhead.
Given that operatorList caching in the API doesn't have to be perfect[1], but only have to avoid *false* cache-hits, we can simplify things significantly be only keeping track of the last time that the `AnnotationStorage`-data was modified.
*Please note:* While working on this patch, I also noticed that the `renderInteractiveForms`- and `includeAnnotationStorage`-options in the `PDFPageProxy.render` method are mutually exclusive.[2]
Given that the various Annotation-related options in `PDFPageProxy.render` have been added at different times, this has unfortunately led to the current "messy" situation.[3]
---
[1] Note how we're already not caching operatorLists for pages with *huge* images, in order to save memory, hence there's no guarantee that operatorLists will always be cached.
[2] Setting both to `true` will result in undefined behaviour, since trying to insert `AnnotationStorage`-values into fields that are being excluded from the operatorList-building will obviously not work, which isn't at all clear from the documentation.
[3] My intention is to try and fix this in a follow-up PR, and I've got a WIP patch locally, however it will result in a number of API-observable changes.
2021-08-16 02:57:42 +09:00
|
|
|
|
/**
|
|
|
|
|
* Refer to the `WorkerTransport.getRenderingIntent`-method in the API, to see
|
|
|
|
|
* how these flags are being used:
|
|
|
|
|
* - ANY, DISPLAY, and PRINT are the normal rendering intents, note the
|
|
|
|
|
* `PDFPageProxy.{render, getOperatorList, getAnnotations}`-methods.
|
[api-minor] Introduce a new `annotationMode`-option, in `PDFPageProxy.{render, getOperatorList}`
*This is a follow-up to PRs 13867 and 13899.*
This patch is tagged `api-minor` for the following reasons:
- It replaces the `renderInteractiveForms`/`includeAnnotationStorage`-options, in the `PDFPageProxy.render`-method, with the single `annotationMode`-option that controls which annotations are being rendered and how. Note that the old options were mutually exclusive, and setting both to `true` would result in undefined behaviour.
- For improved consistency in the API, the `annotationMode`-option will also work together with the `PDFPageProxy.getOperatorList`-method.
- It's now also possible to disable *all* annotation rendering in both the API and the Viewer, since the other changes meant that this could now be supported with a single added line on the worker-thread[1]; fixes 7282.
---
[1] Please note that in order to simplify the overall implementation, we'll purposely only support disabling of *all* annotations and that the option is being shared between the API and the Viewer. For any more "specialized" use-cases, where e.g. only some annotation-types are being rendered and/or the API and Viewer render different sets of annotations, that'll have to be handled in third-party implementations/forks of the PDF.js code-base.
2021-08-08 21:36:28 +09:00
|
|
|
|
* - ANNOTATIONS_FORMS, ANNOTATIONS_STORAGE, ANNOTATIONS_DISABLE control which
|
|
|
|
|
* annotations are rendered onto the canvas (i.e. by being included in the
|
|
|
|
|
* operatorList), note the `PDFPageProxy.{render, getOperatorList}`-methods
|
|
|
|
|
* and their `annotationMode`-option.
|
[Regression] Re-factor the *internal* `includeAnnotationStorage` handling, since it's currently subtly wrong
*This patch is very similar to the recently fixed `renderInteractiveForms`-options, see PR 13867.*
As far as I can tell, this *subtle* bug has existed ever since `AnnotationStorage`-support was first added in PR 12106 (a little over a year ago).
The value of the `includeAnnotationStorage`-option, as passed to the `PDFPageProxy.render` method, will (potentially) affect the size/content of the operatorList that's returned from the worker (for documents with forms).
Given that operatorLists will generally, unless they contain huge images, be cached in the API, repeated `PDFPageProxy.render` calls where the form-data has been changed by the user in between, can thus *wrongly* return a cached operatorList.
In the viewer we're only using the `includeAnnotationStorage`-option when printing, which is probably why this has gone unnoticed for so long. Note that we, for performance reasons, don't cache printing-operatorLists in the API.
However, there's nothing stopping an API-user from using the `includeAnnotationStorage`-option during "normal" rendering, which could thus result in *subtle* (and difficult to understand) rendering bugs.
In order to handle this, we need to know if the `AnnotationStorage`-instance has been updated since the last `PDFPageProxy.render` call. The most "correct" solution would obviously be to create a hash of the `AnnotationStorage` contents, however that would require adding a bunch of code, complexity, and runtime overhead.
Given that operatorList caching in the API doesn't have to be perfect[1], but only have to avoid *false* cache-hits, we can simplify things significantly be only keeping track of the last time that the `AnnotationStorage`-data was modified.
*Please note:* While working on this patch, I also noticed that the `renderInteractiveForms`- and `includeAnnotationStorage`-options in the `PDFPageProxy.render` method are mutually exclusive.[2]
Given that the various Annotation-related options in `PDFPageProxy.render` have been added at different times, this has unfortunately led to the current "messy" situation.[3]
---
[1] Note how we're already not caching operatorLists for pages with *huge* images, in order to save memory, hence there's no guarantee that operatorLists will always be cached.
[2] Setting both to `true` will result in undefined behaviour, since trying to insert `AnnotationStorage`-values into fields that are being excluded from the operatorList-building will obviously not work, which isn't at all clear from the documentation.
[3] My intention is to try and fix this in a follow-up PR, and I've got a WIP patch locally, however it will result in a number of API-observable changes.
2021-08-16 02:57:42 +09:00
|
|
|
|
* - OPLIST is used with the `PDFPageProxy.getOperatorList`-method, note the
|
|
|
|
|
* `OperatorList`-constructor (on the worker-thread).
|
|
|
|
|
*/
|
[api-minor] Re-factor the *internal* renderingIntent, and change the default `intent` value in the `PDFPageProxy.getAnnotations` method
With the changes made in PR 13746 the *internal* renderingIntent handling became somewhat "messy", since we're now having to do string-matching in various spots in order to handle the "oplist"-intent correctly.
Hence this patch, which implements the idea from PR 13746 to convert the `intent`-strings, used in various API-methods, into an *internal* renderingIntent that's implemented using a bit-field instead. *Please note:* This part of the patch, in itself, does *not* change the public API (but see below).
This patch is tagged `api-minor` for the following reasons:
1. It changes the *default* value for the `intent` parameter, in the `PDFPageProxy.getAnnotations` method, to "display" in order to be consistent across the API.
2. In order to get *all* annotations, with the `PDFPageProxy.getAnnotations` method, you now need to explicitly set "any" as the `intent` parameter.
3. The `PDFPageProxy.getOperatorList` method will now also support the new "any" intent, to allow accessing the operatorList of all annotations (limited to those types that have one).
4. Finally, for consistency across the API, the `PDFPageProxy.render` method also support the new "any" intent (although I'm not sure how useful that'll be).
Points 1 and 2 above are the significant, and thus breaking, changes in *default* behaviour here. However, unfortunately I cannot see a good way to improve the overall API while also keeping `PDFPageProxy.getAnnotations` unchanged.
2021-08-02 21:30:08 +09:00
|
|
|
|
const RenderingIntentFlag = {
|
|
|
|
|
ANY: 0x01,
|
|
|
|
|
DISPLAY: 0x02,
|
|
|
|
|
PRINT: 0x04,
|
2022-10-19 00:07:47 +09:00
|
|
|
|
SAVE: 0x08,
|
[Regression] Re-factor the *internal* `includeAnnotationStorage` handling, since it's currently subtly wrong
*This patch is very similar to the recently fixed `renderInteractiveForms`-options, see PR 13867.*
As far as I can tell, this *subtle* bug has existed ever since `AnnotationStorage`-support was first added in PR 12106 (a little over a year ago).
The value of the `includeAnnotationStorage`-option, as passed to the `PDFPageProxy.render` method, will (potentially) affect the size/content of the operatorList that's returned from the worker (for documents with forms).
Given that operatorLists will generally, unless they contain huge images, be cached in the API, repeated `PDFPageProxy.render` calls where the form-data has been changed by the user in between, can thus *wrongly* return a cached operatorList.
In the viewer we're only using the `includeAnnotationStorage`-option when printing, which is probably why this has gone unnoticed for so long. Note that we, for performance reasons, don't cache printing-operatorLists in the API.
However, there's nothing stopping an API-user from using the `includeAnnotationStorage`-option during "normal" rendering, which could thus result in *subtle* (and difficult to understand) rendering bugs.
In order to handle this, we need to know if the `AnnotationStorage`-instance has been updated since the last `PDFPageProxy.render` call. The most "correct" solution would obviously be to create a hash of the `AnnotationStorage` contents, however that would require adding a bunch of code, complexity, and runtime overhead.
Given that operatorList caching in the API doesn't have to be perfect[1], but only have to avoid *false* cache-hits, we can simplify things significantly be only keeping track of the last time that the `AnnotationStorage`-data was modified.
*Please note:* While working on this patch, I also noticed that the `renderInteractiveForms`- and `includeAnnotationStorage`-options in the `PDFPageProxy.render` method are mutually exclusive.[2]
Given that the various Annotation-related options in `PDFPageProxy.render` have been added at different times, this has unfortunately led to the current "messy" situation.[3]
---
[1] Note how we're already not caching operatorLists for pages with *huge* images, in order to save memory, hence there's no guarantee that operatorLists will always be cached.
[2] Setting both to `true` will result in undefined behaviour, since trying to insert `AnnotationStorage`-values into fields that are being excluded from the operatorList-building will obviously not work, which isn't at all clear from the documentation.
[3] My intention is to try and fix this in a follow-up PR, and I've got a WIP patch locally, however it will result in a number of API-observable changes.
2021-08-16 02:57:42 +09:00
|
|
|
|
ANNOTATIONS_FORMS: 0x10,
|
|
|
|
|
ANNOTATIONS_STORAGE: 0x20,
|
[api-minor] Introduce a new `annotationMode`-option, in `PDFPageProxy.{render, getOperatorList}`
*This is a follow-up to PRs 13867 and 13899.*
This patch is tagged `api-minor` for the following reasons:
- It replaces the `renderInteractiveForms`/`includeAnnotationStorage`-options, in the `PDFPageProxy.render`-method, with the single `annotationMode`-option that controls which annotations are being rendered and how. Note that the old options were mutually exclusive, and setting both to `true` would result in undefined behaviour.
- For improved consistency in the API, the `annotationMode`-option will also work together with the `PDFPageProxy.getOperatorList`-method.
- It's now also possible to disable *all* annotation rendering in both the API and the Viewer, since the other changes meant that this could now be supported with a single added line on the worker-thread[1]; fixes 7282.
---
[1] Please note that in order to simplify the overall implementation, we'll purposely only support disabling of *all* annotations and that the option is being shared between the API and the Viewer. For any more "specialized" use-cases, where e.g. only some annotation-types are being rendered and/or the API and Viewer render different sets of annotations, that'll have to be handled in third-party implementations/forks of the PDF.js code-base.
2021-08-08 21:36:28 +09:00
|
|
|
|
ANNOTATIONS_DISABLE: 0x40,
|
[api-minor] Re-factor the *internal* renderingIntent, and change the default `intent` value in the `PDFPageProxy.getAnnotations` method
With the changes made in PR 13746 the *internal* renderingIntent handling became somewhat "messy", since we're now having to do string-matching in various spots in order to handle the "oplist"-intent correctly.
Hence this patch, which implements the idea from PR 13746 to convert the `intent`-strings, used in various API-methods, into an *internal* renderingIntent that's implemented using a bit-field instead. *Please note:* This part of the patch, in itself, does *not* change the public API (but see below).
This patch is tagged `api-minor` for the following reasons:
1. It changes the *default* value for the `intent` parameter, in the `PDFPageProxy.getAnnotations` method, to "display" in order to be consistent across the API.
2. In order to get *all* annotations, with the `PDFPageProxy.getAnnotations` method, you now need to explicitly set "any" as the `intent` parameter.
3. The `PDFPageProxy.getOperatorList` method will now also support the new "any" intent, to allow accessing the operatorList of all annotations (limited to those types that have one).
4. Finally, for consistency across the API, the `PDFPageProxy.render` method also support the new "any" intent (although I'm not sure how useful that'll be).
Points 1 and 2 above are the significant, and thus breaking, changes in *default* behaviour here. However, unfortunately I cannot see a good way to improve the overall API while also keeping `PDFPageProxy.getAnnotations` unchanged.
2021-08-02 21:30:08 +09:00
|
|
|
|
OPLIST: 0x100,
|
|
|
|
|
};
|
|
|
|
|
|
[api-minor] Introduce a new `annotationMode`-option, in `PDFPageProxy.{render, getOperatorList}`
*This is a follow-up to PRs 13867 and 13899.*
This patch is tagged `api-minor` for the following reasons:
- It replaces the `renderInteractiveForms`/`includeAnnotationStorage`-options, in the `PDFPageProxy.render`-method, with the single `annotationMode`-option that controls which annotations are being rendered and how. Note that the old options were mutually exclusive, and setting both to `true` would result in undefined behaviour.
- For improved consistency in the API, the `annotationMode`-option will also work together with the `PDFPageProxy.getOperatorList`-method.
- It's now also possible to disable *all* annotation rendering in both the API and the Viewer, since the other changes meant that this could now be supported with a single added line on the worker-thread[1]; fixes 7282.
---
[1] Please note that in order to simplify the overall implementation, we'll purposely only support disabling of *all* annotations and that the option is being shared between the API and the Viewer. For any more "specialized" use-cases, where e.g. only some annotation-types are being rendered and/or the API and Viewer render different sets of annotations, that'll have to be handled in third-party implementations/forks of the PDF.js code-base.
2021-08-08 21:36:28 +09:00
|
|
|
|
const AnnotationMode = {
|
|
|
|
|
DISABLE: 0,
|
|
|
|
|
ENABLE: 1,
|
|
|
|
|
ENABLE_FORMS: 2,
|
|
|
|
|
ENABLE_STORAGE: 3,
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-01 17:38:08 +09:00
|
|
|
|
const AnnotationEditorPrefix = "pdfjs_internal_editor_";
|
|
|
|
|
|
|
|
|
|
const AnnotationEditorType = {
|
2022-06-29 18:13:03 +09:00
|
|
|
|
DISABLE: -1,
|
2022-06-01 17:38:08 +09:00
|
|
|
|
NONE: 0,
|
2022-06-05 04:32:27 +09:00
|
|
|
|
FREETEXT: 3,
|
2022-06-05 06:28:19 +09:00
|
|
|
|
INK: 15,
|
2022-06-01 17:38:08 +09:00
|
|
|
|
};
|
|
|
|
|
|
2022-06-14 01:23:10 +09:00
|
|
|
|
const AnnotationEditorParamsType = {
|
2022-07-25 05:19:09 +09:00
|
|
|
|
FREETEXT_SIZE: 1,
|
|
|
|
|
FREETEXT_COLOR: 2,
|
|
|
|
|
FREETEXT_OPACITY: 3,
|
|
|
|
|
INK_COLOR: 11,
|
|
|
|
|
INK_THICKNESS: 12,
|
|
|
|
|
INK_OPACITY: 13,
|
2022-06-14 01:23:10 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-08-27 04:37:05 +09:00
|
|
|
|
// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.
|
|
|
|
|
const PermissionFlag = {
|
|
|
|
|
PRINT: 0x04,
|
|
|
|
|
MODIFY_CONTENTS: 0x08,
|
|
|
|
|
COPY: 0x10,
|
|
|
|
|
MODIFY_ANNOTATIONS: 0x20,
|
|
|
|
|
FILL_INTERACTIVE_FORMS: 0x100,
|
|
|
|
|
COPY_FOR_ACCESSIBILITY: 0x200,
|
|
|
|
|
ASSEMBLE: 0x400,
|
|
|
|
|
PRINT_HIGH_QUALITY: 0x800,
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const TextRenderingMode = {
|
2013-08-20 08:33:20 +09:00
|
|
|
|
FILL: 0,
|
|
|
|
|
STROKE: 1,
|
|
|
|
|
FILL_STROKE: 2,
|
|
|
|
|
INVISIBLE: 3,
|
|
|
|
|
FILL_ADD_TO_PATH: 4,
|
|
|
|
|
STROKE_ADD_TO_PATH: 5,
|
|
|
|
|
FILL_STROKE_ADD_TO_PATH: 6,
|
|
|
|
|
ADD_TO_PATH: 7,
|
|
|
|
|
FILL_STROKE_MASK: 3,
|
Fix inconsistent spacing and trailing commas in objects in remaining `src/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
- positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+ positions[i + 1]], x: 0, y: 0, w: width, h: height, });
}
this.paintInlineImageXObjectGroup(imgData, map);
},
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x];
- opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+ opList.push({
+ 'fnId': fnId,
+ 'fn': REVOPS[fnId],
+ 'args': argsArray[x],
+ });
}
return opListToTree(opList);
},
```
2017-06-02 18:26:37 +09:00
|
|
|
|
ADD_TO_PATH_FLAG: 4,
|
2013-08-20 08:33:20 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const ImageKind = {
|
2014-02-26 08:11:15 +09:00
|
|
|
|
GRAYSCALE_1BPP: 1,
|
|
|
|
|
RGB_24BPP: 2,
|
Fix inconsistent spacing and trailing commas in objects in remaining `src/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
- positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+ positions[i + 1]], x: 0, y: 0, w: width, h: height, });
}
this.paintInlineImageXObjectGroup(imgData, map);
},
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x];
- opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+ opList.push({
+ 'fnId': fnId,
+ 'fn': REVOPS[fnId],
+ 'args': argsArray[x],
+ });
}
return opListToTree(opList);
},
```
2017-06-02 18:26:37 +09:00
|
|
|
|
RGBA_32BPP: 3,
|
2014-02-26 08:11:15 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const AnnotationType = {
|
2015-12-15 22:52:17 +09:00
|
|
|
|
TEXT: 1,
|
|
|
|
|
LINK: 2,
|
|
|
|
|
FREETEXT: 3,
|
|
|
|
|
LINE: 4,
|
|
|
|
|
SQUARE: 5,
|
|
|
|
|
CIRCLE: 6,
|
|
|
|
|
POLYGON: 7,
|
|
|
|
|
POLYLINE: 8,
|
|
|
|
|
HIGHLIGHT: 9,
|
|
|
|
|
UNDERLINE: 10,
|
|
|
|
|
SQUIGGLY: 11,
|
|
|
|
|
STRIKEOUT: 12,
|
|
|
|
|
STAMP: 13,
|
|
|
|
|
CARET: 14,
|
|
|
|
|
INK: 15,
|
|
|
|
|
POPUP: 16,
|
|
|
|
|
FILEATTACHMENT: 17,
|
|
|
|
|
SOUND: 18,
|
|
|
|
|
MOVIE: 19,
|
|
|
|
|
WIDGET: 20,
|
|
|
|
|
SCREEN: 21,
|
|
|
|
|
PRINTERMARK: 22,
|
|
|
|
|
TRAPNET: 23,
|
|
|
|
|
WATERMARK: 24,
|
|
|
|
|
THREED: 25,
|
Fix inconsistent spacing and trailing commas in objects in remaining `src/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
- positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+ positions[i + 1]], x: 0, y: 0, w: width, h: height, });
}
this.paintInlineImageXObjectGroup(imgData, map);
},
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x];
- opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+ opList.push({
+ 'fnId': fnId,
+ 'fn': REVOPS[fnId],
+ 'args': argsArray[x],
+ });
}
return opListToTree(opList);
},
```
2017-06-02 18:26:37 +09:00
|
|
|
|
REDACT: 26,
|
2014-06-18 07:43:33 +09:00
|
|
|
|
};
|
|
|
|
|
|
2019-05-15 04:14:35 +09:00
|
|
|
|
const AnnotationStateModelType = {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
MARKED: "Marked",
|
|
|
|
|
REVIEW: "Review",
|
2019-05-15 04:14:35 +09:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const AnnotationMarkedState = {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
MARKED: "Marked",
|
|
|
|
|
UNMARKED: "Unmarked",
|
2019-05-15 04:14:35 +09:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const AnnotationReviewState = {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
ACCEPTED: "Accepted",
|
|
|
|
|
REJECTED: "Rejected",
|
|
|
|
|
CANCELLED: "Cancelled",
|
|
|
|
|
COMPLETED: "Completed",
|
|
|
|
|
NONE: "None",
|
2019-05-15 04:14:35 +09:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const AnnotationReplyType = {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
GROUP: "Group",
|
|
|
|
|
REPLY: "R",
|
2019-05-15 04:14:35 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const AnnotationFlag = {
|
2015-11-22 07:25:17 +09:00
|
|
|
|
INVISIBLE: 0x01,
|
|
|
|
|
HIDDEN: 0x02,
|
|
|
|
|
PRINT: 0x04,
|
|
|
|
|
NOZOOM: 0x08,
|
|
|
|
|
NOROTATE: 0x10,
|
|
|
|
|
NOVIEW: 0x20,
|
|
|
|
|
READONLY: 0x40,
|
|
|
|
|
LOCKED: 0x80,
|
|
|
|
|
TOGGLENOVIEW: 0x100,
|
Fix inconsistent spacing and trailing commas in objects in remaining `src/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
- positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+ positions[i + 1]], x: 0, y: 0, w: width, h: height, });
}
this.paintInlineImageXObjectGroup(imgData, map);
},
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x];
- opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+ opList.push({
+ 'fnId': fnId,
+ 'fn': REVOPS[fnId],
+ 'args': argsArray[x],
+ });
}
return opListToTree(opList);
},
```
2017-06-02 18:26:37 +09:00
|
|
|
|
LOCKEDCONTENTS: 0x200,
|
2015-11-22 07:25:17 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const AnnotationFieldFlag = {
|
2016-09-22 04:06:44 +09:00
|
|
|
|
READONLY: 0x0000001,
|
|
|
|
|
REQUIRED: 0x0000002,
|
|
|
|
|
NOEXPORT: 0x0000004,
|
|
|
|
|
MULTILINE: 0x0001000,
|
|
|
|
|
PASSWORD: 0x0002000,
|
|
|
|
|
NOTOGGLETOOFF: 0x0004000,
|
|
|
|
|
RADIO: 0x0008000,
|
|
|
|
|
PUSHBUTTON: 0x0010000,
|
|
|
|
|
COMBO: 0x0020000,
|
|
|
|
|
EDIT: 0x0040000,
|
|
|
|
|
SORT: 0x0080000,
|
|
|
|
|
FILESELECT: 0x0100000,
|
|
|
|
|
MULTISELECT: 0x0200000,
|
|
|
|
|
DONOTSPELLCHECK: 0x0400000,
|
|
|
|
|
DONOTSCROLL: 0x0800000,
|
|
|
|
|
COMB: 0x1000000,
|
|
|
|
|
RICHTEXT: 0x2000000,
|
|
|
|
|
RADIOSINUNISON: 0x2000000,
|
|
|
|
|
COMMITONSELCHANGE: 0x4000000,
|
2016-09-14 23:32:51 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const AnnotationBorderStyleType = {
|
2014-12-26 04:11:23 +09:00
|
|
|
|
SOLID: 1,
|
|
|
|
|
DASHED: 2,
|
|
|
|
|
BEVELED: 3,
|
|
|
|
|
INSET: 4,
|
Fix inconsistent spacing and trailing commas in objects in remaining `src/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
- positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+ positions[i + 1]], x: 0, y: 0, w: width, h: height, });
}
this.paintInlineImageXObjectGroup(imgData, map);
},
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x];
- opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+ opList.push({
+ 'fnId': fnId,
+ 'fn': REVOPS[fnId],
+ 'args': argsArray[x],
+ });
}
return opListToTree(opList);
},
```
2017-06-02 18:26:37 +09:00
|
|
|
|
UNDERLINE: 5,
|
2014-12-26 04:11:23 +09:00
|
|
|
|
};
|
|
|
|
|
|
2020-10-01 03:58:45 +09:00
|
|
|
|
const AnnotationActionEventType = {
|
2021-01-24 03:09:26 +09:00
|
|
|
|
E: "Mouse Enter",
|
|
|
|
|
X: "Mouse Exit",
|
|
|
|
|
D: "Mouse Down",
|
|
|
|
|
U: "Mouse Up",
|
2020-10-01 03:58:45 +09:00
|
|
|
|
Fo: "Focus",
|
|
|
|
|
Bl: "Blur",
|
|
|
|
|
PO: "PageOpen",
|
|
|
|
|
PC: "PageClose",
|
|
|
|
|
PV: "PageVisible",
|
|
|
|
|
PI: "PageInvisible",
|
|
|
|
|
K: "Keystroke",
|
|
|
|
|
F: "Format",
|
|
|
|
|
V: "Validate",
|
|
|
|
|
C: "Calculate",
|
2020-12-08 03:22:14 +09:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const DocumentActionEventType = {
|
2020-10-01 03:58:45 +09:00
|
|
|
|
WC: "WillClose",
|
|
|
|
|
WS: "WillSave",
|
|
|
|
|
DS: "DidSave",
|
|
|
|
|
WP: "WillPrint",
|
|
|
|
|
DP: "DidPrint",
|
|
|
|
|
};
|
|
|
|
|
|
2020-12-08 03:22:14 +09:00
|
|
|
|
const PageActionEventType = {
|
|
|
|
|
O: "PageOpen",
|
|
|
|
|
C: "PageClose",
|
|
|
|
|
};
|
|
|
|
|
|
2018-02-15 01:35:08 +09:00
|
|
|
|
const VerbosityLevel = {
|
|
|
|
|
ERRORS: 0,
|
|
|
|
|
WARNINGS: 1,
|
|
|
|
|
INFOS: 5,
|
2013-12-19 06:39:03 +09:00
|
|
|
|
};
|
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const CMapCompressionType = {
|
2017-02-12 23:54:41 +09:00
|
|
|
|
NONE: 0,
|
|
|
|
|
BINARY: 1,
|
|
|
|
|
};
|
|
|
|
|
|
2013-11-14 04:43:38 +09:00
|
|
|
|
// All the possible operations for an operator list.
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const OPS = {
|
2013-11-18 19:58:38 +09:00
|
|
|
|
// Intentionally start from 1 so it is easy to spot bad operators that will be
|
2013-11-14 04:43:38 +09:00
|
|
|
|
// 0's.
|
2022-10-09 01:06:42 +09:00
|
|
|
|
// PLEASE NOTE: We purposely keep any removed operators commented out, since
|
|
|
|
|
// re-numbering the list would risk breaking third-party users.
|
2013-11-14 04:43:38 +09:00
|
|
|
|
dependency: 1,
|
|
|
|
|
setLineWidth: 2,
|
|
|
|
|
setLineCap: 3,
|
|
|
|
|
setLineJoin: 4,
|
|
|
|
|
setMiterLimit: 5,
|
|
|
|
|
setDash: 6,
|
|
|
|
|
setRenderingIntent: 7,
|
|
|
|
|
setFlatness: 8,
|
|
|
|
|
setGState: 9,
|
|
|
|
|
save: 10,
|
|
|
|
|
restore: 11,
|
|
|
|
|
transform: 12,
|
|
|
|
|
moveTo: 13,
|
|
|
|
|
lineTo: 14,
|
|
|
|
|
curveTo: 15,
|
|
|
|
|
curveTo2: 16,
|
|
|
|
|
curveTo3: 17,
|
|
|
|
|
closePath: 18,
|
|
|
|
|
rectangle: 19,
|
|
|
|
|
stroke: 20,
|
|
|
|
|
closeStroke: 21,
|
|
|
|
|
fill: 22,
|
|
|
|
|
eoFill: 23,
|
|
|
|
|
fillStroke: 24,
|
|
|
|
|
eoFillStroke: 25,
|
|
|
|
|
closeFillStroke: 26,
|
|
|
|
|
closeEOFillStroke: 27,
|
|
|
|
|
endPath: 28,
|
|
|
|
|
clip: 29,
|
|
|
|
|
eoClip: 30,
|
|
|
|
|
beginText: 31,
|
|
|
|
|
endText: 32,
|
|
|
|
|
setCharSpacing: 33,
|
|
|
|
|
setWordSpacing: 34,
|
|
|
|
|
setHScale: 35,
|
|
|
|
|
setLeading: 36,
|
|
|
|
|
setFont: 37,
|
|
|
|
|
setTextRenderingMode: 38,
|
|
|
|
|
setTextRise: 39,
|
|
|
|
|
moveText: 40,
|
|
|
|
|
setLeadingMoveText: 41,
|
|
|
|
|
setTextMatrix: 42,
|
|
|
|
|
nextLine: 43,
|
|
|
|
|
showText: 44,
|
|
|
|
|
showSpacedText: 45,
|
|
|
|
|
nextLineShowText: 46,
|
|
|
|
|
nextLineSetSpacingShowText: 47,
|
|
|
|
|
setCharWidth: 48,
|
|
|
|
|
setCharWidthAndBounds: 49,
|
|
|
|
|
setStrokeColorSpace: 50,
|
|
|
|
|
setFillColorSpace: 51,
|
|
|
|
|
setStrokeColor: 52,
|
|
|
|
|
setStrokeColorN: 53,
|
|
|
|
|
setFillColor: 54,
|
|
|
|
|
setFillColorN: 55,
|
|
|
|
|
setStrokeGray: 56,
|
|
|
|
|
setFillGray: 57,
|
|
|
|
|
setStrokeRGBColor: 58,
|
|
|
|
|
setFillRGBColor: 59,
|
|
|
|
|
setStrokeCMYKColor: 60,
|
|
|
|
|
setFillCMYKColor: 61,
|
|
|
|
|
shadingFill: 62,
|
|
|
|
|
beginInlineImage: 63,
|
|
|
|
|
beginImageData: 64,
|
|
|
|
|
endInlineImage: 65,
|
|
|
|
|
paintXObject: 66,
|
|
|
|
|
markPoint: 67,
|
|
|
|
|
markPointProps: 68,
|
|
|
|
|
beginMarkedContent: 69,
|
|
|
|
|
beginMarkedContentProps: 70,
|
|
|
|
|
endMarkedContent: 71,
|
|
|
|
|
beginCompat: 72,
|
|
|
|
|
endCompat: 73,
|
|
|
|
|
paintFormXObjectBegin: 74,
|
|
|
|
|
paintFormXObjectEnd: 75,
|
|
|
|
|
beginGroup: 76,
|
|
|
|
|
endGroup: 77,
|
2022-10-09 01:06:42 +09:00
|
|
|
|
// beginAnnotations: 78,
|
|
|
|
|
// endAnnotations: 79,
|
2013-11-14 04:43:38 +09:00
|
|
|
|
beginAnnotation: 80,
|
|
|
|
|
endAnnotation: 81,
|
2022-10-09 01:06:42 +09:00
|
|
|
|
// paintJpegXObject: 82,
|
2013-11-14 04:43:38 +09:00
|
|
|
|
paintImageMaskXObject: 83,
|
|
|
|
|
paintImageMaskXObjectGroup: 84,
|
|
|
|
|
paintImageXObject: 85,
|
|
|
|
|
paintInlineImageXObject: 86,
|
2014-02-24 23:00:08 +09:00
|
|
|
|
paintInlineImageXObjectGroup: 87,
|
2014-02-25 00:59:02 +09:00
|
|
|
|
paintImageXObjectRepeat: 88,
|
2014-03-17 00:17:13 +09:00
|
|
|
|
paintImageMaskXObjectRepeat: 89,
|
2014-04-30 23:09:04 +09:00
|
|
|
|
paintSolidColorImageMask: 90,
|
Fix inconsistent spacing and trailing commas in objects in remaining `src/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 5739f6f2..4216b2d2 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2071,7 +2071,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var map = [];
for (var i = 0, ii = positions.length; i < ii; i += 2) {
map.push({ transform: [scaleX, 0, 0, scaleY, positions[i],
- positions[i + 1]], x: 0, y: 0, w: width, h: height, });
+ positions[i + 1]], x: 0, y: 0, w: width, h: height, });
}
this.paintInlineImageXObjectGroup(imgData, map);
},
diff --git a/src/display/svg.js b/src/display/svg.js
index 9eb05dfa..2aa21482 100644
--- a/src/display/svg.js
+++ b/src/display/svg.js
@@ -458,7 +458,11 @@ SVGGraphics = (function SVGGraphicsClosure() {
for (var x = 0; x < fnArrayLen; x++) {
var fnId = fnArray[x];
- opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x], });
+ opList.push({
+ 'fnId': fnId,
+ 'fn': REVOPS[fnId],
+ 'args': argsArray[x],
+ });
}
return opListToTree(opList);
},
```
2017-06-02 18:26:37 +09:00
|
|
|
|
constructPath: 91,
|
2013-11-14 04:43:38 +09:00
|
|
|
|
};
|
2013-08-13 02:48:06 +09:00
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const PasswordResponses = {
|
|
|
|
|
NEED_PASSWORD: 1,
|
|
|
|
|
INCORRECT_PASSWORD: 2,
|
|
|
|
|
};
|
|
|
|
|
|
2018-02-15 01:35:08 +09:00
|
|
|
|
let verbosity = VerbosityLevel.WARNINGS;
|
2016-03-03 09:48:21 +09:00
|
|
|
|
|
|
|
|
|
function setVerbosityLevel(level) {
|
2018-02-15 01:35:08 +09:00
|
|
|
|
if (Number.isInteger(level)) {
|
|
|
|
|
verbosity = level;
|
|
|
|
|
}
|
2016-03-03 09:48:21 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getVerbosityLevel() {
|
|
|
|
|
return verbosity;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-04 02:34:13 +09:00
|
|
|
|
// A notice for devs. These are good for things that are helpful to devs, such
|
|
|
|
|
// as warning that Workers were disabled, which is important to devs but not
|
|
|
|
|
// end users.
|
2012-05-15 09:19:09 +09:00
|
|
|
|
function info(msg) {
|
2018-02-15 01:35:08 +09:00
|
|
|
|
if (verbosity >= VerbosityLevel.INFOS) {
|
2019-08-11 21:10:29 +09:00
|
|
|
|
console.log(`Info: ${msg}`);
|
2012-05-15 09:19:09 +09:00
|
|
|
|
}
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-04 02:34:13 +09:00
|
|
|
|
// Non-fatal warnings.
|
2012-05-15 09:19:09 +09:00
|
|
|
|
function warn(msg) {
|
2018-02-15 01:35:08 +09:00
|
|
|
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
2019-08-11 21:10:29 +09:00
|
|
|
|
console.log(`Warning: ${msg}`);
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-29 05:51:31 +09:00
|
|
|
|
function unreachable(msg) {
|
2011-10-25 08:55:23 +09:00
|
|
|
|
throw new Error(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function assert(cond, msg) {
|
2014-03-03 21:21:57 +09:00
|
|
|
|
if (!cond) {
|
2017-06-29 05:51:31 +09:00
|
|
|
|
unreachable(msg);
|
2014-03-03 21:21:57 +09:00
|
|
|
|
}
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-30 00:15:14 +09:00
|
|
|
|
// Checks if URLs use one of the allowed protocols, e.g. to avoid XSS.
|
2018-09-11 22:16:07 +09:00
|
|
|
|
function _isValidProtocol(url) {
|
2021-09-17 20:46:47 +09:00
|
|
|
|
switch (url?.protocol) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
case "http:":
|
|
|
|
|
case "https:":
|
|
|
|
|
case "ftp:":
|
|
|
|
|
case "mailto:":
|
|
|
|
|
case "tel:":
|
2013-07-13 03:36:20 +09:00
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-22 20:59:23 +09:00
|
|
|
|
|
2016-10-03 21:35:29 +09:00
|
|
|
|
/**
|
2018-09-11 22:16:07 +09:00
|
|
|
|
* Attempts to create a valid absolute URL.
|
|
|
|
|
*
|
2016-10-03 21:35:29 +09:00
|
|
|
|
* @param {URL|string} url - An absolute, or relative, URL.
|
2021-09-26 21:16:28 +09:00
|
|
|
|
* @param {URL|string} [baseUrl] - An absolute URL.
|
|
|
|
|
* @param {Object} [options]
|
2016-10-03 21:35:29 +09:00
|
|
|
|
* @returns Either a valid {URL}, or `null` otherwise.
|
|
|
|
|
*/
|
2021-09-26 21:16:28 +09:00
|
|
|
|
function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
|
2016-10-03 21:35:29 +09:00
|
|
|
|
if (!url) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
try {
|
2021-09-26 21:16:28 +09:00
|
|
|
|
if (options && typeof url === "string") {
|
|
|
|
|
// Let URLs beginning with "www." default to using the "http://" protocol.
|
|
|
|
|
if (options.addDefaultProtocol && url.startsWith("www.")) {
|
|
|
|
|
const dots = url.match(/\./g);
|
|
|
|
|
// Avoid accidentally matching a *relative* URL pointing to a file named
|
|
|
|
|
// e.g. "www.pdf" or similar.
|
2021-09-17 20:46:47 +09:00
|
|
|
|
if (dots?.length >= 2) {
|
2021-09-26 21:16:28 +09:00
|
|
|
|
url = `http://${url}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// According to ISO 32000-1:2008, section 12.6.4.7, URIs should be encoded
|
|
|
|
|
// in 7-bit ASCII. Some bad PDFs use UTF-8 encoding; see bug 1122280.
|
|
|
|
|
if (options.tryConvertEncoding) {
|
|
|
|
|
try {
|
|
|
|
|
url = stringToUTF8String(url);
|
|
|
|
|
} catch (ex) {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-11 21:10:29 +09:00
|
|
|
|
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
2018-09-11 22:16:07 +09:00
|
|
|
|
if (_isValidProtocol(absoluteUrl)) {
|
2016-10-03 21:35:29 +09:00
|
|
|
|
return absoluteUrl;
|
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
} catch (ex) {
|
|
|
|
|
/* `new URL()` will throw on incorrect data. */
|
|
|
|
|
}
|
2016-10-03 21:35:29 +09:00
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-03 18:20:18 +09:00
|
|
|
|
function shadow(obj, prop, value, nonSerializable = false) {
|
2023-03-18 20:09:25 +09:00
|
|
|
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
2021-12-04 17:58:17 +09:00
|
|
|
|
assert(
|
|
|
|
|
prop in obj,
|
|
|
|
|
`shadow: Property "${prop && prop.toString()}" not found in object.`
|
|
|
|
|
);
|
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
Object.defineProperty(obj, prop, {
|
|
|
|
|
value,
|
2022-11-03 18:20:18 +09:00
|
|
|
|
enumerable: !nonSerializable,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
configurable: true,
|
|
|
|
|
writable: false,
|
|
|
|
|
});
|
2011-10-25 08:55:23 +09:00
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-23 05:38:04 +09:00
|
|
|
|
/**
|
|
|
|
|
* @type {any}
|
|
|
|
|
*/
|
2019-09-29 08:18:48 +09:00
|
|
|
|
const BaseException = (function BaseExceptionClosure() {
|
2020-03-25 18:15:50 +09:00
|
|
|
|
// eslint-disable-next-line no-shadow
|
2021-08-09 19:02:49 +09:00
|
|
|
|
function BaseException(message, name) {
|
2019-09-29 08:18:48 +09:00
|
|
|
|
if (this.constructor === BaseException) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
unreachable("Cannot initialize BaseException.");
|
2019-09-29 08:18:48 +09:00
|
|
|
|
}
|
|
|
|
|
this.message = message;
|
2021-08-09 19:02:49 +09:00
|
|
|
|
this.name = name;
|
2012-05-18 04:34:39 +09:00
|
|
|
|
}
|
2019-09-29 08:18:48 +09:00
|
|
|
|
BaseException.prototype = new Error();
|
|
|
|
|
BaseException.constructor = BaseException;
|
2012-05-18 04:34:39 +09:00
|
|
|
|
|
2019-09-29 08:18:48 +09:00
|
|
|
|
return BaseException;
|
2012-05-18 04:34:39 +09:00
|
|
|
|
})();
|
2012-05-15 03:45:07 +09:00
|
|
|
|
|
2019-09-29 08:18:48 +09:00
|
|
|
|
class PasswordException extends BaseException {
|
|
|
|
|
constructor(msg, code) {
|
2021-08-09 19:02:49 +09:00
|
|
|
|
super(msg, "PasswordException");
|
2019-09-29 08:18:48 +09:00
|
|
|
|
this.code = code;
|
2012-10-16 19:10:37 +09:00
|
|
|
|
}
|
2019-09-29 08:18:48 +09:00
|
|
|
|
}
|
2012-10-16 19:10:37 +09:00
|
|
|
|
|
2019-09-29 08:18:48 +09:00
|
|
|
|
class UnknownErrorException extends BaseException {
|
|
|
|
|
constructor(msg, details) {
|
2021-08-09 19:02:49 +09:00
|
|
|
|
super(msg, "UnknownErrorException");
|
2019-09-29 08:18:48 +09:00
|
|
|
|
this.details = details;
|
2013-01-30 03:13:28 +09:00
|
|
|
|
}
|
2019-09-29 08:18:48 +09:00
|
|
|
|
}
|
2013-01-30 03:13:28 +09:00
|
|
|
|
|
2021-08-09 19:02:49 +09:00
|
|
|
|
class InvalidPDFException extends BaseException {
|
|
|
|
|
constructor(msg) {
|
|
|
|
|
super(msg, "InvalidPDFException");
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-01-30 03:13:28 +09:00
|
|
|
|
|
2021-08-09 19:02:49 +09:00
|
|
|
|
class MissingPDFException extends BaseException {
|
|
|
|
|
constructor(msg) {
|
|
|
|
|
super(msg, "MissingPDFException");
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-01-30 03:13:28 +09:00
|
|
|
|
|
2019-09-29 08:18:48 +09:00
|
|
|
|
class UnexpectedResponseException extends BaseException {
|
|
|
|
|
constructor(msg, status) {
|
2021-08-09 19:02:49 +09:00
|
|
|
|
super(msg, "UnexpectedResponseException");
|
2014-09-13 23:47:16 +09:00
|
|
|
|
this.status = status;
|
|
|
|
|
}
|
2019-09-29 08:18:48 +09:00
|
|
|
|
}
|
2014-09-13 23:47:16 +09:00
|
|
|
|
|
2017-06-29 05:51:31 +09:00
|
|
|
|
/**
|
|
|
|
|
* Error caused during parsing PDF data.
|
|
|
|
|
*/
|
2021-08-09 19:02:49 +09:00
|
|
|
|
class FormatError extends BaseException {
|
|
|
|
|
constructor(msg) {
|
|
|
|
|
super(msg, "FormatError");
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-29 05:51:31 +09:00
|
|
|
|
|
2017-08-04 06:36:46 +09:00
|
|
|
|
/**
|
|
|
|
|
* Error used to indicate task cancellation.
|
|
|
|
|
*/
|
2021-08-09 19:02:49 +09:00
|
|
|
|
class AbortException extends BaseException {
|
|
|
|
|
constructor(msg) {
|
|
|
|
|
super(msg, "AbortException");
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-08-04 06:36:46 +09:00
|
|
|
|
|
2011-10-25 08:55:23 +09:00
|
|
|
|
function bytesToString(bytes) {
|
2021-09-17 20:46:47 +09:00
|
|
|
|
if (typeof bytes !== "object" || bytes?.length === undefined) {
|
2022-01-15 20:45:27 +09:00
|
|
|
|
unreachable("Invalid argument for bytesToString");
|
|
|
|
|
}
|
2019-08-11 21:10:29 +09:00
|
|
|
|
const length = bytes.length;
|
|
|
|
|
const MAX_ARGUMENT_COUNT = 8192;
|
2014-03-27 21:01:43 +09:00
|
|
|
|
if (length < MAX_ARGUMENT_COUNT) {
|
|
|
|
|
return String.fromCharCode.apply(null, bytes);
|
|
|
|
|
}
|
2019-08-11 21:10:29 +09:00
|
|
|
|
const strBuf = [];
|
|
|
|
|
for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
|
|
|
|
const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
|
|
|
|
const chunk = bytes.subarray(i, chunkEnd);
|
2014-03-27 21:01:43 +09:00
|
|
|
|
strBuf.push(String.fromCharCode.apply(null, chunk));
|
2014-02-28 08:23:56 +09:00
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
return strBuf.join("");
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function stringToBytes(str) {
|
2022-01-15 20:45:27 +09:00
|
|
|
|
if (typeof str !== "string") {
|
|
|
|
|
unreachable("Invalid argument for stringToBytes");
|
|
|
|
|
}
|
2019-08-11 21:10:29 +09:00
|
|
|
|
const length = str.length;
|
|
|
|
|
const bytes = new Uint8Array(length);
|
|
|
|
|
for (let i = 0; i < length; ++i) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
bytes[i] = str.charCodeAt(i) & 0xff;
|
2014-03-03 21:21:57 +09:00
|
|
|
|
}
|
2011-10-25 08:55:23 +09:00
|
|
|
|
return bytes;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-27 21:01:43 +09:00
|
|
|
|
function string32(value) {
|
2023-03-18 20:09:25 +09:00
|
|
|
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
2021-06-27 22:19:02 +09:00
|
|
|
|
assert(
|
|
|
|
|
typeof value === "number" && Math.abs(value) < 2 ** 32,
|
|
|
|
|
`string32: Unexpected input "${value}".`
|
|
|
|
|
);
|
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
return String.fromCharCode(
|
|
|
|
|
(value >> 24) & 0xff,
|
|
|
|
|
(value >> 16) & 0xff,
|
|
|
|
|
(value >> 8) & 0xff,
|
|
|
|
|
value & 0xff
|
|
|
|
|
);
|
2014-03-27 21:01:43 +09:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-29 22:17:32 +09:00
|
|
|
|
function objectSize(obj) {
|
|
|
|
|
return Object.keys(obj).length;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-12 00:20:53 +09:00
|
|
|
|
// Ensure that the returned Object has a `null` prototype; hence why
|
|
|
|
|
// `Object.fromEntries(...)` is not used.
|
|
|
|
|
function objectFromMap(map) {
|
|
|
|
|
const obj = Object.create(null);
|
|
|
|
|
for (const [key, value] of map) {
|
|
|
|
|
obj[key] = value;
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
2020-10-28 22:04:09 +09:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-10 17:38:33 +09:00
|
|
|
|
// Checks the endianness of the platform.
|
2014-03-21 00:57:11 +09:00
|
|
|
|
function isLittleEndian() {
|
2019-08-11 21:10:29 +09:00
|
|
|
|
const buffer8 = new Uint8Array(4);
|
2014-03-21 00:57:11 +09:00
|
|
|
|
buffer8[0] = 1;
|
2019-08-11 21:10:29 +09:00
|
|
|
|
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
return view32[0] === 1;
|
2014-03-21 00:57:11 +09:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-29 04:49:22 +09:00
|
|
|
|
// Checks if it's possible to eval JS expressions.
|
|
|
|
|
function isEvalSupported() {
|
|
|
|
|
try {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
new Function(""); // eslint-disable-line no-new, no-new-func
|
2016-03-29 04:49:22 +09:00
|
|
|
|
return true;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-05 23:01:01 +09:00
|
|
|
|
|
|
|
|
|
class FeatureTest {
|
|
|
|
|
static get isLittleEndian() {
|
|
|
|
|
return shadow(this, "isLittleEndian", isLittleEndian());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static get isEvalSupported() {
|
|
|
|
|
return shadow(this, "isEvalSupported", isEvalSupported());
|
|
|
|
|
}
|
2022-04-06 22:34:08 +09:00
|
|
|
|
|
|
|
|
|
static get isOffscreenCanvasSupported() {
|
|
|
|
|
return shadow(
|
|
|
|
|
this,
|
|
|
|
|
"isOffscreenCanvasSupported",
|
|
|
|
|
typeof OffscreenCanvas !== "undefined"
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-11-29 20:14:40 +09:00
|
|
|
|
|
|
|
|
|
static get platform() {
|
|
|
|
|
if (
|
|
|
|
|
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
|
|
|
|
|
typeof navigator === "undefined"
|
|
|
|
|
) {
|
|
|
|
|
return shadow(this, "platform", { isWin: false, isMac: false });
|
|
|
|
|
}
|
|
|
|
|
return shadow(this, "platform", {
|
|
|
|
|
isWin: navigator.platform.includes("Win"),
|
|
|
|
|
isMac: navigator.platform.includes("Mac"),
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-04-05 23:01:01 +09:00
|
|
|
|
}
|
2016-03-29 04:49:22 +09:00
|
|
|
|
|
2020-10-30 22:51:50 +09:00
|
|
|
|
const hexNumbers = [...Array(256).keys()].map(n =>
|
|
|
|
|
n.toString(16).padStart(2, "0")
|
|
|
|
|
);
|
2012-02-02 07:48:44 +09:00
|
|
|
|
|
2019-08-11 20:56:15 +09:00
|
|
|
|
class Util {
|
2020-10-30 22:51:50 +09:00
|
|
|
|
static makeHexColor(r, g, b) {
|
|
|
|
|
return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2012-02-02 07:48:44 +09:00
|
|
|
|
|
2022-04-17 22:35:07 +09:00
|
|
|
|
// Apply a scaling matrix to some min/max values.
|
|
|
|
|
// If a scaling factor is negative then min and max must be
|
|
|
|
|
// swaped.
|
|
|
|
|
static scaleMinMax(transform, minMax) {
|
|
|
|
|
let temp;
|
|
|
|
|
if (transform[0]) {
|
|
|
|
|
if (transform[0] < 0) {
|
|
|
|
|
temp = minMax[0];
|
|
|
|
|
minMax[0] = minMax[1];
|
|
|
|
|
minMax[1] = temp;
|
|
|
|
|
}
|
|
|
|
|
minMax[0] *= transform[0];
|
|
|
|
|
minMax[1] *= transform[0];
|
|
|
|
|
|
|
|
|
|
if (transform[3] < 0) {
|
|
|
|
|
temp = minMax[2];
|
|
|
|
|
minMax[2] = minMax[3];
|
|
|
|
|
minMax[3] = temp;
|
|
|
|
|
}
|
|
|
|
|
minMax[2] *= transform[3];
|
|
|
|
|
minMax[3] *= transform[3];
|
|
|
|
|
} else {
|
|
|
|
|
temp = minMax[0];
|
|
|
|
|
minMax[0] = minMax[2];
|
|
|
|
|
minMax[2] = temp;
|
|
|
|
|
temp = minMax[1];
|
|
|
|
|
minMax[1] = minMax[3];
|
|
|
|
|
minMax[3] = temp;
|
|
|
|
|
|
|
|
|
|
if (transform[1] < 0) {
|
|
|
|
|
temp = minMax[2];
|
|
|
|
|
minMax[2] = minMax[3];
|
|
|
|
|
minMax[3] = temp;
|
|
|
|
|
}
|
|
|
|
|
minMax[2] *= transform[1];
|
|
|
|
|
minMax[3] *= transform[1];
|
|
|
|
|
|
|
|
|
|
if (transform[2] < 0) {
|
|
|
|
|
temp = minMax[0];
|
|
|
|
|
minMax[0] = minMax[1];
|
|
|
|
|
minMax[1] = temp;
|
|
|
|
|
}
|
|
|
|
|
minMax[0] *= transform[2];
|
|
|
|
|
minMax[1] *= transform[2];
|
|
|
|
|
}
|
|
|
|
|
minMax[0] += transform[4];
|
|
|
|
|
minMax[1] += transform[4];
|
|
|
|
|
minMax[2] += transform[5];
|
|
|
|
|
minMax[3] += transform[5];
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-16 08:14:07 +09:00
|
|
|
|
// Concatenates two transformation matrices together and returns the result.
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static transform(m1, m2) {
|
2013-04-16 08:14:07 +09:00
|
|
|
|
return [
|
|
|
|
|
m1[0] * m2[0] + m1[2] * m2[1],
|
|
|
|
|
m1[1] * m2[0] + m1[3] * m2[1],
|
|
|
|
|
m1[0] * m2[2] + m1[2] * m2[3],
|
|
|
|
|
m1[1] * m2[2] + m1[3] * m2[3],
|
|
|
|
|
m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
m1[1] * m2[4] + m1[3] * m2[5] + m1[5],
|
2013-04-16 08:14:07 +09:00
|
|
|
|
];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2013-04-16 08:14:07 +09:00
|
|
|
|
|
2012-02-02 07:48:44 +09:00
|
|
|
|
// For 2d affine transforms
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static applyTransform(p, m) {
|
|
|
|
|
const xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
|
|
|
|
const yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
2011-10-25 08:55:23 +09:00
|
|
|
|
return [xt, yt];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2011-10-25 08:55:23 +09:00
|
|
|
|
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static applyInverseTransform(p, m) {
|
|
|
|
|
const d = m[0] * m[3] - m[1] * m[2];
|
|
|
|
|
const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
|
|
|
|
const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
2012-04-12 00:29:44 +09:00
|
|
|
|
return [xt, yt];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2012-04-12 00:29:44 +09:00
|
|
|
|
|
2013-03-13 09:20:38 +09:00
|
|
|
|
// Applies the transform to the rectangle and finds the minimum axially
|
|
|
|
|
// aligned bounding box.
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static getAxialAlignedBoundingBox(r, m) {
|
|
|
|
|
const p1 = Util.applyTransform(r, m);
|
|
|
|
|
const p2 = Util.applyTransform(r.slice(2, 4), m);
|
|
|
|
|
const p3 = Util.applyTransform([r[0], r[3]], m);
|
|
|
|
|
const p4 = Util.applyTransform([r[2], r[1]], m);
|
2013-03-13 09:20:38 +09:00
|
|
|
|
return [
|
|
|
|
|
Math.min(p1[0], p2[0], p3[0], p4[0]),
|
|
|
|
|
Math.min(p1[1], p2[1], p3[1], p4[1]),
|
|
|
|
|
Math.max(p1[0], p2[0], p3[0], p4[0]),
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
Math.max(p1[1], p2[1], p3[1], p4[1]),
|
2013-03-13 09:20:38 +09:00
|
|
|
|
];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2013-03-13 09:20:38 +09:00
|
|
|
|
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static inverseTransform(m) {
|
|
|
|
|
const d = m[0] * m[3] - m[1] * m[2];
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
return [
|
|
|
|
|
m[3] / d,
|
|
|
|
|
-m[1] / d,
|
|
|
|
|
-m[2] / d,
|
|
|
|
|
m[0] / d,
|
|
|
|
|
(m[2] * m[5] - m[4] * m[3]) / d,
|
|
|
|
|
(m[4] * m[1] - m[5] * m[0]) / d,
|
|
|
|
|
];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2012-04-12 00:29:44 +09:00
|
|
|
|
|
2012-12-27 16:35:25 +09:00
|
|
|
|
// This calculation uses Singular Value Decomposition.
|
|
|
|
|
// The SVD can be represented with formula A = USV. We are interested in the
|
|
|
|
|
// matrix S here because it represents the scale values.
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static singularValueDecompose2dScale(m) {
|
|
|
|
|
const transpose = [m[0], m[2], m[1], m[3]];
|
2012-12-27 16:35:25 +09:00
|
|
|
|
|
|
|
|
|
// Multiply matrix m with its transpose.
|
2019-08-11 20:56:15 +09:00
|
|
|
|
const a = m[0] * transpose[0] + m[1] * transpose[2];
|
|
|
|
|
const b = m[0] * transpose[1] + m[1] * transpose[3];
|
|
|
|
|
const c = m[2] * transpose[0] + m[3] * transpose[2];
|
|
|
|
|
const d = m[2] * transpose[1] + m[3] * transpose[3];
|
2012-12-27 16:35:25 +09:00
|
|
|
|
|
|
|
|
|
// Solve the second degree polynomial to get roots.
|
2019-08-11 20:56:15 +09:00
|
|
|
|
const first = (a + d) / 2;
|
2021-02-10 20:28:49 +09:00
|
|
|
|
const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
|
2019-08-11 20:56:15 +09:00
|
|
|
|
const sx = first + second || 1;
|
|
|
|
|
const sy = first - second || 1;
|
2012-12-27 16:35:25 +09:00
|
|
|
|
|
|
|
|
|
// Scale values are the square roots of the eigenvalues.
|
|
|
|
|
return [Math.sqrt(sx), Math.sqrt(sy)];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2012-12-27 16:35:25 +09:00
|
|
|
|
|
2012-02-15 04:48:58 +09:00
|
|
|
|
// Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
|
|
|
|
|
// For coordinate systems whose origin lies in the bottom-left, this
|
|
|
|
|
// means normalization to (BL,TR) ordering. For systems with origin in the
|
|
|
|
|
// top-left, this means (TL,BR) ordering.
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static normalizeRect(rect) {
|
|
|
|
|
const r = rect.slice(0); // clone rect
|
2012-02-15 04:48:58 +09:00
|
|
|
|
if (rect[0] > rect[2]) {
|
|
|
|
|
r[0] = rect[2];
|
|
|
|
|
r[2] = rect[0];
|
|
|
|
|
}
|
|
|
|
|
if (rect[1] > rect[3]) {
|
|
|
|
|
r[1] = rect[3];
|
|
|
|
|
r[3] = rect[1];
|
|
|
|
|
}
|
|
|
|
|
return r;
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2012-02-15 04:48:58 +09:00
|
|
|
|
|
|
|
|
|
// Returns a rectangle [x1, y1, x2, y2] corresponding to the
|
2022-04-16 01:31:14 +09:00
|
|
|
|
// intersection of rect1 and rect2. If no intersection, returns 'null'
|
2012-02-15 04:48:58 +09:00
|
|
|
|
// The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]
|
2019-08-11 20:56:15 +09:00
|
|
|
|
static intersect(rect1, rect2) {
|
2022-04-16 01:31:14 +09:00
|
|
|
|
const xLow = Math.max(
|
|
|
|
|
Math.min(rect1[0], rect1[2]),
|
|
|
|
|
Math.min(rect2[0], rect2[2])
|
|
|
|
|
);
|
|
|
|
|
const xHigh = Math.min(
|
|
|
|
|
Math.max(rect1[0], rect1[2]),
|
|
|
|
|
Math.max(rect2[0], rect2[2])
|
|
|
|
|
);
|
|
|
|
|
if (xLow > xHigh) {
|
Fallback gracefully when encountering corrupt PDF files with empty /MediaBox and /CropBox entries
This is based on a real-world PDF file I encountered very recently[1], although I'm currently unable to recall where I saw it.
Note that different PDF viewers handle these sort of errors differently, with Adobe Reader outright failing to render the attached PDF file whereas PDFium mostly handles it "correctly".
The patch makes the following notable changes:
- Refactor the `cropBox` and `mediaBox` getters, on the `Page`, to reduce unnecessary duplication. (This will also help in the future, if support for extracting additional page bounding boxes are added to the API.)
- Ensure that the page bounding boxes, i.e. `cropBox` and `mediaBox`, are never empty to prevent issues/weirdness in the viewer.
- Ensure that the `view` getter on the `Page` will never return an empty intersection of the `cropBox` and `mediaBox`.
- Add an *optional* parameter to `Util.intersect`, to allow checking that the computed intersection isn't actually empty.
- Change `Util.intersect` to have consistent return types, since Arrays are of type `Object` and falling back to returning a `Boolean` thus seem strange.
---
[1] In that case I believe that only the `cropBox` was empty, but it seemed like a good idea to attempt to fix a bunch of related cases all at once.
2019-08-08 22:54:46 +09:00
|
|
|
|
return null;
|
2012-02-15 04:48:58 +09:00
|
|
|
|
}
|
2022-04-16 01:31:14 +09:00
|
|
|
|
const yLow = Math.max(
|
|
|
|
|
Math.min(rect1[1], rect1[3]),
|
|
|
|
|
Math.min(rect2[1], rect2[3])
|
|
|
|
|
);
|
|
|
|
|
const yHigh = Math.min(
|
|
|
|
|
Math.max(rect1[1], rect1[3]),
|
|
|
|
|
Math.max(rect2[1], rect2[3])
|
|
|
|
|
);
|
|
|
|
|
if (yLow > yHigh) {
|
Fallback gracefully when encountering corrupt PDF files with empty /MediaBox and /CropBox entries
This is based on a real-world PDF file I encountered very recently[1], although I'm currently unable to recall where I saw it.
Note that different PDF viewers handle these sort of errors differently, with Adobe Reader outright failing to render the attached PDF file whereas PDFium mostly handles it "correctly".
The patch makes the following notable changes:
- Refactor the `cropBox` and `mediaBox` getters, on the `Page`, to reduce unnecessary duplication. (This will also help in the future, if support for extracting additional page bounding boxes are added to the API.)
- Ensure that the page bounding boxes, i.e. `cropBox` and `mediaBox`, are never empty to prevent issues/weirdness in the viewer.
- Ensure that the `view` getter on the `Page` will never return an empty intersection of the `cropBox` and `mediaBox`.
- Add an *optional* parameter to `Util.intersect`, to allow checking that the computed intersection isn't actually empty.
- Change `Util.intersect` to have consistent return types, since Arrays are of type `Object` and falling back to returning a `Boolean` thus seem strange.
---
[1] In that case I believe that only the `cropBox` was empty, but it seemed like a good idea to attempt to fix a bunch of related cases all at once.
2019-08-08 22:54:46 +09:00
|
|
|
|
return null;
|
2012-02-15 04:48:58 +09:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-16 01:31:14 +09:00
|
|
|
|
return [xLow, yLow, xHigh, yHigh];
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2021-10-22 07:22:11 +09:00
|
|
|
|
|
|
|
|
|
// From https://github.com/adobe-webplatform/Snap.svg/blob/b365287722a72526000ac4bfcf0ce4cac2faa015/src/path.js#L852
|
|
|
|
|
static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
|
|
|
const tvalues = [],
|
|
|
|
|
bounds = [[], []];
|
|
|
|
|
let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
|
|
|
|
|
for (let i = 0; i < 2; ++i) {
|
|
|
|
|
if (i === 0) {
|
|
|
|
|
b = 6 * x0 - 12 * x1 + 6 * x2;
|
|
|
|
|
a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
|
|
|
|
|
c = 3 * x1 - 3 * x0;
|
|
|
|
|
} else {
|
|
|
|
|
b = 6 * y0 - 12 * y1 + 6 * y2;
|
|
|
|
|
a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
|
|
|
|
|
c = 3 * y1 - 3 * y0;
|
|
|
|
|
}
|
|
|
|
|
if (Math.abs(a) < 1e-12) {
|
|
|
|
|
if (Math.abs(b) < 1e-12) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
t = -c / b;
|
|
|
|
|
if (0 < t && t < 1) {
|
|
|
|
|
tvalues.push(t);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
b2ac = b * b - 4 * c * a;
|
|
|
|
|
sqrtb2ac = Math.sqrt(b2ac);
|
|
|
|
|
if (b2ac < 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
t1 = (-b + sqrtb2ac) / (2 * a);
|
|
|
|
|
if (0 < t1 && t1 < 1) {
|
|
|
|
|
tvalues.push(t1);
|
|
|
|
|
}
|
|
|
|
|
t2 = (-b - sqrtb2ac) / (2 * a);
|
|
|
|
|
if (0 < t2 && t2 < 1) {
|
|
|
|
|
tvalues.push(t2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let j = tvalues.length,
|
|
|
|
|
mt;
|
|
|
|
|
const jlen = j;
|
|
|
|
|
while (j--) {
|
|
|
|
|
t = tvalues[j];
|
|
|
|
|
mt = 1 - t;
|
|
|
|
|
bounds[0][j] =
|
|
|
|
|
mt * mt * mt * x0 +
|
|
|
|
|
3 * mt * mt * t * x1 +
|
|
|
|
|
3 * mt * t * t * x2 +
|
|
|
|
|
t * t * t * x3;
|
|
|
|
|
bounds[1][j] =
|
|
|
|
|
mt * mt * mt * y0 +
|
|
|
|
|
3 * mt * mt * t * y1 +
|
|
|
|
|
3 * mt * t * t * y2 +
|
|
|
|
|
t * t * t * y3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bounds[0][jlen] = x0;
|
|
|
|
|
bounds[1][jlen] = y0;
|
|
|
|
|
bounds[0][jlen + 1] = x3;
|
|
|
|
|
bounds[1][jlen + 1] = y3;
|
|
|
|
|
bounds[0].length = bounds[1].length = jlen + 2;
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
Math.min(...bounds[0]),
|
|
|
|
|
Math.min(...bounds[1]),
|
|
|
|
|
Math.max(...bounds[0]),
|
|
|
|
|
Math.max(...bounds[1]),
|
|
|
|
|
];
|
|
|
|
|
}
|
2019-08-11 20:56:15 +09:00
|
|
|
|
}
|
2011-10-25 08:55:23 +09:00
|
|
|
|
|
2018-09-11 22:27:15 +09:00
|
|
|
|
const PDFStringTranslateTable = [
|
2021-05-19 18:24:38 +09:00
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8,
|
|
|
|
|
0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2011-10-25 08:55:23 +09:00
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
2021-05-19 18:24:38 +09:00
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192,
|
|
|
|
|
0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018,
|
|
|
|
|
0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d,
|
|
|
|
|
0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac,
|
2011-10-25 08:55:23 +09:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
function stringToPDFString(str) {
|
2022-01-15 02:44:38 +09:00
|
|
|
|
if (str[0] >= "\xEF") {
|
|
|
|
|
let encoding;
|
|
|
|
|
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
|
|
|
|
encoding = "utf-16be";
|
|
|
|
|
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
|
|
|
|
|
encoding = "utf-16le";
|
|
|
|
|
} else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
|
|
|
|
|
encoding = "utf-8";
|
2014-02-28 08:23:56 +09:00
|
|
|
|
}
|
2022-01-15 02:44:38 +09:00
|
|
|
|
|
|
|
|
|
if (encoding) {
|
|
|
|
|
try {
|
|
|
|
|
const decoder = new TextDecoder(encoding, { fatal: true });
|
|
|
|
|
const buffer = stringToBytes(str);
|
|
|
|
|
return decoder.decode(buffer);
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
warn(`stringToPDFString: "${ex}".`);
|
|
|
|
|
}
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-15 01:58:47 +09:00
|
|
|
|
// ISO Latin 1
|
2022-01-15 02:44:38 +09:00
|
|
|
|
const strBuf = [];
|
|
|
|
|
for (let i = 0, ii = str.length; i < ii; i++) {
|
2022-01-15 01:58:47 +09:00
|
|
|
|
const code = PDFStringTranslateTable[str.charCodeAt(i)];
|
|
|
|
|
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
|
return strBuf.join("");
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-28 05:49:28 +09:00
|
|
|
|
function stringToUTF8String(str) {
|
|
|
|
|
return decodeURIComponent(escape(str));
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-14 00:25:42 +09:00
|
|
|
|
function utf8StringToString(str) {
|
|
|
|
|
return unescape(encodeURIComponent(str));
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-25 08:55:23 +09:00
|
|
|
|
function isArrayBuffer(v) {
|
2021-09-17 20:46:47 +09:00
|
|
|
|
return typeof v === "object" && v?.byteLength !== undefined;
|
2011-10-25 08:55:23 +09:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-08 20:55:44 +09:00
|
|
|
|
function isArrayEqual(arr1, arr2) {
|
|
|
|
|
if (arr1.length !== arr2.length) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-02-26 23:51:32 +09:00
|
|
|
|
for (let i = 0, ii = arr1.length; i < ii; i++) {
|
|
|
|
|
if (arr1[i] !== arr2[i]) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2019-03-08 20:55:44 +09:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-10 00:56:28 +09:00
|
|
|
|
function getModificationDate(date = new Date()) {
|
2020-08-04 02:44:04 +09:00
|
|
|
|
const buffer = [
|
|
|
|
|
date.getUTCFullYear().toString(),
|
|
|
|
|
(date.getUTCMonth() + 1).toString().padStart(2, "0"),
|
2020-09-10 00:56:28 +09:00
|
|
|
|
date.getUTCDate().toString().padStart(2, "0"),
|
2020-08-04 02:44:04 +09:00
|
|
|
|
date.getUTCHours().toString().padStart(2, "0"),
|
|
|
|
|
date.getUTCMinutes().toString().padStart(2, "0"),
|
|
|
|
|
date.getUTCSeconds().toString().padStart(2, "0"),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return buffer.join("");
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-08 01:41:41 +09:00
|
|
|
|
class PromiseCapability {
|
|
|
|
|
#settled = false;
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
/**
|
|
|
|
|
* @type {Promise<any>} The Promise object.
|
|
|
|
|
*/
|
|
|
|
|
this.promise = new Promise((resolve, reject) => {
|
|
|
|
|
/**
|
|
|
|
|
* @type {function} Fulfills the Promise.
|
|
|
|
|
*/
|
|
|
|
|
this.resolve = data => {
|
|
|
|
|
this.#settled = true;
|
|
|
|
|
resolve(data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {function} Rejects the Promise.
|
|
|
|
|
*/
|
|
|
|
|
this.reject = reason => {
|
|
|
|
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
|
|
|
|
assert(reason instanceof Error, 'Expected valid "reason" argument.');
|
|
|
|
|
}
|
|
|
|
|
this.#settled = true;
|
|
|
|
|
reject(reason);
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-04-29 03:51:53 +09:00
|
|
|
|
|
2022-03-08 01:41:41 +09:00
|
|
|
|
/**
|
|
|
|
|
* @type {boolean} If the Promise has been fulfilled/rejected.
|
|
|
|
|
*/
|
|
|
|
|
get settled() {
|
|
|
|
|
return this.#settled;
|
|
|
|
|
}
|
2014-04-29 03:51:53 +09:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-23 18:15:14 +09:00
|
|
|
|
let NormalizeRegex = null;
|
|
|
|
|
let NormalizationMap = null;
|
|
|
|
|
function normalizeUnicode(str) {
|
|
|
|
|
if (!NormalizeRegex) {
|
|
|
|
|
// In order to generate the following regex:
|
|
|
|
|
// - create a PDF containing all the chars in the range 0000-FFFF with
|
|
|
|
|
// a NFKC which is different of the char.
|
|
|
|
|
// - copy and paste all those chars and get the ones where NFKC is
|
|
|
|
|
// required.
|
|
|
|
|
// It appears that most the chars here contain some ligatures.
|
|
|
|
|
NormalizeRegex =
|
|
|
|
|
/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
|
|
|
|
|
NormalizationMap = new Map([["ſt", "ſt"]]);
|
|
|
|
|
}
|
|
|
|
|
return str.replaceAll(NormalizeRegex, (_, p1, p2) => {
|
|
|
|
|
return p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-02 20:14:36 +09:00
|
|
|
|
export {
|
2021-01-09 23:37:44 +09:00
|
|
|
|
AbortException,
|
2020-10-01 03:58:45 +09:00
|
|
|
|
AnnotationActionEventType,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
AnnotationBorderStyleType,
|
2022-06-14 01:23:10 +09:00
|
|
|
|
AnnotationEditorParamsType,
|
2022-06-01 17:38:08 +09:00
|
|
|
|
AnnotationEditorPrefix,
|
|
|
|
|
AnnotationEditorType,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
AnnotationFieldFlag,
|
|
|
|
|
AnnotationFlag,
|
2019-05-15 04:14:35 +09:00
|
|
|
|
AnnotationMarkedState,
|
[api-minor] Introduce a new `annotationMode`-option, in `PDFPageProxy.{render, getOperatorList}`
*This is a follow-up to PRs 13867 and 13899.*
This patch is tagged `api-minor` for the following reasons:
- It replaces the `renderInteractiveForms`/`includeAnnotationStorage`-options, in the `PDFPageProxy.render`-method, with the single `annotationMode`-option that controls which annotations are being rendered and how. Note that the old options were mutually exclusive, and setting both to `true` would result in undefined behaviour.
- For improved consistency in the API, the `annotationMode`-option will also work together with the `PDFPageProxy.getOperatorList`-method.
- It's now also possible to disable *all* annotation rendering in both the API and the Viewer, since the other changes meant that this could now be supported with a single added line on the worker-thread[1]; fixes 7282.
---
[1] Please note that in order to simplify the overall implementation, we'll purposely only support disabling of *all* annotations and that the option is being shared between the API and the Viewer. For any more "specialized" use-cases, where e.g. only some annotation-types are being rendered and/or the API and Viewer render different sets of annotations, that'll have to be handled in third-party implementations/forks of the PDF.js code-base.
2021-08-08 21:36:28 +09:00
|
|
|
|
AnnotationMode,
|
2019-05-15 04:14:35 +09:00
|
|
|
|
AnnotationReplyType,
|
|
|
|
|
AnnotationReviewState,
|
|
|
|
|
AnnotationStateModelType,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
AnnotationType,
|
|
|
|
|
assert,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
BaseException,
|
2022-10-19 00:07:47 +09:00
|
|
|
|
BASELINE_FACTOR,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
bytesToString,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
CMapCompressionType,
|
|
|
|
|
createValidAbsoluteUrl,
|
|
|
|
|
DocumentActionEventType,
|
2022-04-05 23:01:01 +09:00
|
|
|
|
FeatureTest,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
FONT_IDENTITY_MATRIX,
|
|
|
|
|
FormatError,
|
2020-08-04 02:44:04 +09:00
|
|
|
|
getModificationDate,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
getVerbosityLevel,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
IDENTITY_MATRIX,
|
|
|
|
|
ImageKind,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
info,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
InvalidPDFException,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
isArrayBuffer,
|
2019-03-08 20:55:44 +09:00
|
|
|
|
isArrayEqual,
|
2022-06-01 22:42:46 +09:00
|
|
|
|
LINE_DESCENT_FACTOR,
|
2022-05-19 22:12:28 +09:00
|
|
|
|
LINE_FACTOR,
|
2023-03-04 19:22:59 +09:00
|
|
|
|
MAX_IMAGE_SIZE_TO_CACHE,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
MissingPDFException,
|
2023-03-23 18:15:14 +09:00
|
|
|
|
normalizeUnicode,
|
2021-03-12 00:20:53 +09:00
|
|
|
|
objectFromMap,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
objectSize,
|
|
|
|
|
OPS,
|
|
|
|
|
PageActionEventType,
|
|
|
|
|
PasswordException,
|
|
|
|
|
PasswordResponses,
|
|
|
|
|
PermissionFlag,
|
2022-03-08 01:41:41 +09:00
|
|
|
|
PromiseCapability,
|
[api-minor] Re-factor the *internal* renderingIntent, and change the default `intent` value in the `PDFPageProxy.getAnnotations` method
With the changes made in PR 13746 the *internal* renderingIntent handling became somewhat "messy", since we're now having to do string-matching in various spots in order to handle the "oplist"-intent correctly.
Hence this patch, which implements the idea from PR 13746 to convert the `intent`-strings, used in various API-methods, into an *internal* renderingIntent that's implemented using a bit-field instead. *Please note:* This part of the patch, in itself, does *not* change the public API (but see below).
This patch is tagged `api-minor` for the following reasons:
1. It changes the *default* value for the `intent` parameter, in the `PDFPageProxy.getAnnotations` method, to "display" in order to be consistent across the API.
2. In order to get *all* annotations, with the `PDFPageProxy.getAnnotations` method, you now need to explicitly set "any" as the `intent` parameter.
3. The `PDFPageProxy.getOperatorList` method will now also support the new "any" intent, to allow accessing the operatorList of all annotations (limited to those types that have one).
4. Finally, for consistency across the API, the `PDFPageProxy.render` method also support the new "any" intent (although I'm not sure how useful that'll be).
Points 1 and 2 above are the significant, and thus breaking, changes in *default* behaviour here. However, unfortunately I cannot see a good way to improve the overall API while also keeping `PDFPageProxy.getAnnotations` unchanged.
2021-08-02 21:30:08 +09:00
|
|
|
|
RenderingIntentFlag,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
setVerbosityLevel,
|
|
|
|
|
shadow,
|
|
|
|
|
string32,
|
|
|
|
|
stringToBytes,
|
|
|
|
|
stringToPDFString,
|
|
|
|
|
stringToUTF8String,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
TextRenderingMode,
|
|
|
|
|
UnexpectedResponseException,
|
|
|
|
|
UnknownErrorException,
|
|
|
|
|
unreachable,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
utf8StringToString,
|
2021-01-09 23:37:44 +09:00
|
|
|
|
Util,
|
|
|
|
|
VerbosityLevel,
|
2017-04-02 20:14:36 +09:00
|
|
|
|
warn,
|
|
|
|
|
};
|