@vaadin-component-factory/vcf-pdf-viewer 0.9.0 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +1 -1
  2. package/package.json +33 -18
  3. package/{src/display → pdfjs/dist}/display_utils.js +344 -139
  4. package/{src/display → pdfjs/dist}/fetch_stream.js +115 -97
  5. package/pdfjs/dist/get.js +1857 -0
  6. package/pdfjs/dist/index.js +767 -0
  7. package/pdfjs/dist/l10n_utils.js +140 -0
  8. package/{src/shared → pdfjs/dist}/message_handler.js +243 -259
  9. package/{src/display → pdfjs/dist}/network.js +149 -87
  10. package/{src/display/content_disposition.js → pdfjs/dist/network_utils.js} +167 -55
  11. package/{src/display → pdfjs/dist}/node_stream.js +133 -98
  12. package/pdfjs/dist/pdf.js +12778 -0
  13. package/pdfjs/dist/pdf_link_service.js +638 -0
  14. package/pdfjs/dist/pdf_rendering_queue.js +199 -0
  15. package/pdfjs/dist/pdf_thumbnail_viewer.js +819 -0
  16. package/pdfjs/dist/pdf_viewer.js +3598 -0
  17. package/pdfjs/dist/typeof.js +100 -0
  18. package/pdfjs/dist/ui_utils.js +1033 -0
  19. package/{src/shared → pdfjs/dist}/util.js +301 -287
  20. package/pdfjs/dist/worker.js +62813 -0
  21. package/src/vcf-pdf-viewer.js +77 -27
  22. package/theme/lumo/vcf-pdf-viewer-styles.js +1 -1
  23. package/theme/material/vcf-pdf-viewer.js +2 -2
  24. package/src/core/.eslintrc +0 -13
  25. package/src/core/annotation.js +0 -2948
  26. package/src/core/arithmetic_decoder.js +0 -182
  27. package/src/core/ascii_85_stream.js +0 -98
  28. package/src/core/ascii_hex_stream.js +0 -79
  29. package/src/core/base_stream.js +0 -110
  30. package/src/core/bidi.js +0 -438
  31. package/src/core/calibri_factors.js +0 -308
  32. package/src/core/catalog.js +0 -1459
  33. package/src/core/ccitt.js +0 -1062
  34. package/src/core/ccitt_stream.js +0 -60
  35. package/src/core/cff_font.js +0 -116
  36. package/src/core/cff_parser.js +0 -1949
  37. package/src/core/charsets.js +0 -119
  38. package/src/core/chunked_stream.js +0 -557
  39. package/src/core/cmap.js +0 -1039
  40. package/src/core/colorspace.js +0 -1533
  41. package/src/core/core_utils.js +0 -464
  42. package/src/core/crypto.js +0 -1900
  43. package/src/core/decode_stream.js +0 -170
  44. package/src/core/decrypt_stream.js +0 -59
  45. package/src/core/default_appearance.js +0 -99
  46. package/src/core/document.js +0 -1456
  47. package/src/core/encodings.js +0 -301
  48. package/src/core/evaluator.js +0 -4601
  49. package/src/core/file_spec.js +0 -108
  50. package/src/core/flate_stream.js +0 -402
  51. package/src/core/font_renderer.js +0 -882
  52. package/src/core/fonts.js +0 -3260
  53. package/src/core/fonts_utils.js +0 -221
  54. package/src/core/function.js +0 -1257
  55. package/src/core/glyf.js +0 -706
  56. package/src/core/glyphlist.js +0 -4558
  57. package/src/core/helvetica_factors.js +0 -353
  58. package/src/core/image.js +0 -802
  59. package/src/core/image_utils.js +0 -291
  60. package/src/core/jbig2.js +0 -2572
  61. package/src/core/jbig2_stream.js +0 -73
  62. package/src/core/jpeg_stream.js +0 -105
  63. package/src/core/jpg.js +0 -1416
  64. package/src/core/jpx.js +0 -2343
  65. package/src/core/jpx_stream.js +0 -87
  66. package/src/core/liberationsans_widths.js +0 -221
  67. package/src/core/lzw_stream.js +0 -150
  68. package/src/core/metadata_parser.js +0 -146
  69. package/src/core/metrics.js +0 -2970
  70. package/src/core/murmurhash3.js +0 -139
  71. package/src/core/myriadpro_factors.js +0 -290
  72. package/src/core/name_number_tree.js +0 -153
  73. package/src/core/object_loader.js +0 -149
  74. package/src/core/opentype_file_builder.js +0 -154
  75. package/src/core/operator_list.js +0 -734
  76. package/src/core/parser.js +0 -1416
  77. package/src/core/pattern.js +0 -985
  78. package/src/core/pdf_manager.js +0 -217
  79. package/src/core/predictor_stream.js +0 -238
  80. package/src/core/primitives.js +0 -402
  81. package/src/core/ps_parser.js +0 -272
  82. package/src/core/run_length_stream.js +0 -61
  83. package/src/core/segoeui_factors.js +0 -308
  84. package/src/core/standard_fonts.js +0 -817
  85. package/src/core/stream.js +0 -103
  86. package/src/core/struct_tree.js +0 -335
  87. package/src/core/to_unicode_map.js +0 -103
  88. package/src/core/type1_font.js +0 -421
  89. package/src/core/type1_parser.js +0 -776
  90. package/src/core/unicode.js +0 -1649
  91. package/src/core/worker.js +0 -848
  92. package/src/core/worker_stream.js +0 -135
  93. package/src/core/writer.js +0 -278
  94. package/src/core/xfa/bind.js +0 -652
  95. package/src/core/xfa/builder.js +0 -207
  96. package/src/core/xfa/config.js +0 -1926
  97. package/src/core/xfa/connection_set.js +0 -202
  98. package/src/core/xfa/data.js +0 -82
  99. package/src/core/xfa/datasets.js +0 -76
  100. package/src/core/xfa/factory.js +0 -111
  101. package/src/core/xfa/fonts.js +0 -181
  102. package/src/core/xfa/formcalc_lexer.js +0 -385
  103. package/src/core/xfa/formcalc_parser.js +0 -1340
  104. package/src/core/xfa/html_utils.js +0 -639
  105. package/src/core/xfa/layout.js +0 -383
  106. package/src/core/xfa/locale_set.js +0 -345
  107. package/src/core/xfa/namespaces.js +0 -81
  108. package/src/core/xfa/parser.js +0 -184
  109. package/src/core/xfa/setup.js +0 -38
  110. package/src/core/xfa/signature.js +0 -40
  111. package/src/core/xfa/som.js +0 -338
  112. package/src/core/xfa/stylesheet.js +0 -40
  113. package/src/core/xfa/template.js +0 -6260
  114. package/src/core/xfa/text.js +0 -290
  115. package/src/core/xfa/unknown.js +0 -29
  116. package/src/core/xfa/utils.js +0 -217
  117. package/src/core/xfa/xdp.js +0 -59
  118. package/src/core/xfa/xfa_object.js +0 -1130
  119. package/src/core/xfa/xhtml.js +0 -543
  120. package/src/core/xfa_fonts.js +0 -208
  121. package/src/core/xml_parser.js +0 -507
  122. package/src/core/xref.js +0 -899
  123. package/src/display/annotation_layer.js +0 -2107
  124. package/src/display/annotation_storage.js +0 -113
  125. package/src/display/api.js +0 -3292
  126. package/src/display/base_factory.js +0 -180
  127. package/src/display/canvas.js +0 -2828
  128. package/src/display/font_loader.js +0 -484
  129. package/src/display/metadata.js +0 -41
  130. package/src/display/network_utils.js +0 -100
  131. package/src/display/node_utils.js +0 -83
  132. package/src/display/optional_content_config.js +0 -189
  133. package/src/display/pattern_helper.js +0 -659
  134. package/src/display/svg.js +0 -1709
  135. package/src/display/text_layer.js +0 -847
  136. package/src/display/transport_stream.js +0 -303
  137. package/src/display/worker_options.js +0 -40
  138. package/src/display/xfa_layer.js +0 -204
  139. package/src/doc_helper.js +0 -25
  140. package/src/images/logo.svg +0 -41
  141. package/src/interfaces.js +0 -169
  142. package/src/license_header.js +0 -14
  143. package/src/license_header_libre.js +0 -21
  144. package/src/pdf.image_decoders.js +0 -46
  145. package/src/pdf.js +0 -146
  146. package/src/pdf.sandbox.external.js +0 -181
  147. package/src/pdf.sandbox.js +0 -151
  148. package/src/pdf.scripting.js +0 -25
  149. package/src/pdf.worker.entry.js +0 -19
  150. package/src/pdf.worker.js +0 -23
  151. package/src/scripting_api/aform.js +0 -608
  152. package/src/scripting_api/app.js +0 -621
  153. package/src/scripting_api/color.js +0 -129
  154. package/src/scripting_api/common.js +0 -58
  155. package/src/scripting_api/console.js +0 -38
  156. package/src/scripting_api/constants.js +0 -208
  157. package/src/scripting_api/doc.js +0 -1195
  158. package/src/scripting_api/error.js +0 -23
  159. package/src/scripting_api/event.js +0 -232
  160. package/src/scripting_api/field.js +0 -620
  161. package/src/scripting_api/fullscreen.js +0 -145
  162. package/src/scripting_api/initialization.js +0 -223
  163. package/src/scripting_api/pdf_object.js +0 -24
  164. package/src/scripting_api/print_params.js +0 -146
  165. package/src/scripting_api/proxy.js +0 -139
  166. package/src/scripting_api/thermometer.js +0 -69
  167. package/src/scripting_api/util.js +0 -581
  168. package/src/shared/.eslintrc +0 -13
  169. package/src/shared/cffStandardStrings.js +0 -311
  170. package/src/shared/compatibility.js +0 -114
  171. package/src/shared/fonts_utils.js +0 -429
  172. package/src/shared/is_node.js +0 -27
  173. package/src/shared/scripting_utils.js +0 -85
  174. package/src/worker_loader.js +0 -32
@@ -1,145 +0,0 @@
1
- /* Copyright 2020 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- import { Cursor } from "./constants.js";
17
- import { PDFObject } from "./pdf_object.js";
18
-
19
- class FullScreen extends PDFObject {
20
- constructor(data) {
21
- super(data);
22
-
23
- this._backgroundColor = [];
24
- this._clickAdvances = true;
25
- this._cursor = Cursor.hidden;
26
- this._defaultTransition = "";
27
- this._escapeExits = true;
28
- this._isFullScreen = true;
29
- this._loop = false;
30
- this._timeDelay = 3600;
31
- this._usePageTiming = false;
32
- this._useTimer = false;
33
- }
34
-
35
- get backgroundColor() {
36
- return this._backgroundColor;
37
- }
38
-
39
- set backgroundColor(_) {
40
- /* TODO or not */
41
- }
42
-
43
- get clickAdvances() {
44
- return this._clickAdvances;
45
- }
46
-
47
- set clickAdvances(_) {
48
- /* TODO or not */
49
- }
50
-
51
- get cursor() {
52
- return this._cursor;
53
- }
54
-
55
- set cursor(_) {
56
- /* TODO or not */
57
- }
58
-
59
- get defaultTransition() {
60
- return this._defaultTransition;
61
- }
62
-
63
- set defaultTransition(_) {
64
- /* TODO or not */
65
- }
66
-
67
- get escapeExits() {
68
- return this._escapeExits;
69
- }
70
-
71
- set escapeExits(_) {
72
- /* TODO or not */
73
- }
74
-
75
- get isFullScreen() {
76
- return this._isFullScreen;
77
- }
78
-
79
- set isFullScreen(_) {
80
- /* TODO or not */
81
- }
82
-
83
- get loop() {
84
- return this._loop;
85
- }
86
-
87
- set loop(_) {
88
- /* TODO or not */
89
- }
90
-
91
- get timeDelay() {
92
- return this._timeDelay;
93
- }
94
-
95
- set timeDelay(_) {
96
- /* TODO or not */
97
- }
98
-
99
- get transitions() {
100
- // This list of possible value for transition has been found:
101
- // https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/5186AcroJS.pdf#page=198
102
- return [
103
- "Replace",
104
- "WipeRight",
105
- "WipeLeft",
106
- "WipeDown",
107
- "WipeUp",
108
- "SplitHorizontalIn",
109
- "SplitHorizontalOut",
110
- "SplitVerticalIn",
111
- "SplitVerticalOut",
112
- "BlindsHorizontal",
113
- "BlindsVertical",
114
- "BoxIn",
115
- "BoxOut",
116
- "GlitterRight",
117
- "GlitterDown",
118
- "GlitterRightDown",
119
- "Dissolve",
120
- "Random",
121
- ];
122
- }
123
-
124
- set transitions(_) {
125
- throw new Error("fullscreen.transitions is read-only");
126
- }
127
-
128
- get usePageTiming() {
129
- return this._usePageTiming;
130
- }
131
-
132
- set usePageTiming(_) {
133
- /* TODO or not */
134
- }
135
-
136
- get useTimer() {
137
- return this._useTimer;
138
- }
139
-
140
- set useTimer(_) {
141
- /* TODO or not */
142
- }
143
- }
144
-
145
- export { FullScreen };
@@ -1,223 +0,0 @@
1
- /* Copyright 2020 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- import {
17
- Border,
18
- Cursor,
19
- Display,
20
- Font,
21
- GlobalConstants,
22
- Highlight,
23
- Position,
24
- ScaleHow,
25
- ScaleWhen,
26
- Style,
27
- Trans,
28
- ZoomType,
29
- } from "./constants.js";
30
- import { CheckboxField, Field, RadioButtonField } from "./field.js";
31
- import { AForm } from "./aform.js";
32
- import { App } from "./app.js";
33
- import { Color } from "./color.js";
34
- import { Console } from "./console.js";
35
- import { Doc } from "./doc.js";
36
- import { ProxyHandler } from "./proxy.js";
37
- import { Util } from "./util.js";
38
-
39
- function initSandbox(params) {
40
- delete globalThis.pdfjsScripting;
41
-
42
- // externalCall is a function to call a function defined
43
- // outside the sandbox.
44
- // (see src/pdf.sandbox.external.js).
45
- const externalCall = globalThis.callExternalFunction;
46
- delete globalThis.callExternalFunction;
47
-
48
- // eslint-disable-next-line no-eval
49
- const globalEval = code => globalThis.eval(code);
50
- const send = data => externalCall("send", [data]);
51
- const proxyHandler = new ProxyHandler();
52
- const { data } = params;
53
- const doc = new Doc({
54
- send,
55
- globalEval,
56
- ...data.docInfo,
57
- });
58
- const _document = { obj: doc, wrapped: new Proxy(doc, proxyHandler) };
59
- const app = new App({
60
- send,
61
- globalEval,
62
- externalCall,
63
- _document,
64
- calculationOrder: data.calculationOrder,
65
- proxyHandler,
66
- ...data.appInfo,
67
- });
68
-
69
- const util = new Util({ externalCall });
70
- const appObjects = app._objects;
71
-
72
- if (data.objects) {
73
- const annotations = [];
74
-
75
- for (const [name, objs] of Object.entries(data.objects)) {
76
- annotations.length = 0;
77
- let container = null;
78
-
79
- for (const obj of objs) {
80
- if (obj.type !== "") {
81
- annotations.push(obj);
82
- } else {
83
- container = obj;
84
- }
85
- }
86
-
87
- let obj = container;
88
- if (annotations.length > 0) {
89
- obj = annotations[0];
90
- obj.send = send;
91
- }
92
-
93
- obj.globalEval = globalEval;
94
- obj.doc = _document;
95
- obj.fieldPath = name;
96
- obj.appObjects = appObjects;
97
-
98
- let field;
99
- switch (obj.type) {
100
- case "radiobutton": {
101
- const otherButtons = annotations.slice(1);
102
- field = new RadioButtonField(otherButtons, obj);
103
- break;
104
- }
105
- case "checkbox": {
106
- const otherButtons = annotations.slice(1);
107
- field = new CheckboxField(otherButtons, obj);
108
- break;
109
- }
110
- case "text":
111
- if (annotations.length <= 1) {
112
- field = new Field(obj);
113
- break;
114
- }
115
- obj.siblings = annotations.map(x => x.id).slice(1);
116
- field = new Field(obj);
117
- break;
118
- default:
119
- field = new Field(obj);
120
- }
121
-
122
- const wrapped = new Proxy(field, proxyHandler);
123
- doc._addField(name, wrapped);
124
- const _object = { obj: field, wrapped };
125
- for (const object of objs) {
126
- appObjects[object.id] = _object;
127
- }
128
- if (container) {
129
- appObjects[container.id] = _object;
130
- }
131
- }
132
- }
133
-
134
- const color = new Color();
135
-
136
- globalThis.event = null;
137
- globalThis.global = Object.create(null);
138
- globalThis.app = new Proxy(app, proxyHandler);
139
- globalThis.color = new Proxy(color, proxyHandler);
140
- globalThis.console = new Proxy(new Console({ send }), proxyHandler);
141
- globalThis.util = new Proxy(util, proxyHandler);
142
- globalThis.border = Border;
143
- globalThis.cursor = Cursor;
144
- globalThis.display = Display;
145
- globalThis.font = Font;
146
- globalThis.highlight = Highlight;
147
- globalThis.position = Position;
148
- globalThis.scaleHow = ScaleHow;
149
- globalThis.scaleWhen = ScaleWhen;
150
- globalThis.style = Style;
151
- globalThis.trans = Trans;
152
- globalThis.zoomtype = ZoomType;
153
-
154
- // Avoid to have a popup asking to update Acrobat.
155
- globalThis.ADBE = {
156
- Reader_Value_Asked: true,
157
- Viewer_Value_Asked: true,
158
- };
159
-
160
- // AF... functions
161
- const aform = new AForm(doc, app, util, color);
162
- for (const name of Object.getOwnPropertyNames(AForm.prototype)) {
163
- if (name !== "constructor" && !name.startsWith("_")) {
164
- globalThis[name] = aform[name].bind(aform);
165
- }
166
- }
167
-
168
- // Add global constants such as IDS_GREATER_THAN or RE_NUMBER_ENTRY_DOT_SEP
169
- for (const [name, value] of Object.entries(GlobalConstants)) {
170
- Object.defineProperty(globalThis, name, {
171
- value,
172
- writable: false,
173
- });
174
- }
175
-
176
- // Color functions
177
- Object.defineProperties(globalThis, {
178
- ColorConvert: {
179
- value: color.convert.bind(color),
180
- writable: true,
181
- },
182
- ColorEqual: {
183
- value: color.equal.bind(color),
184
- writable: true,
185
- },
186
- });
187
-
188
- // The doc properties must live in the global scope too
189
- const properties = Object.create(null);
190
- for (const name of Object.getOwnPropertyNames(Doc.prototype)) {
191
- if (name === "constructor" || name.startsWith("_")) {
192
- continue;
193
- }
194
- const descriptor = Object.getOwnPropertyDescriptor(Doc.prototype, name);
195
- if (descriptor.get) {
196
- properties[name] = {
197
- get: descriptor.get.bind(doc),
198
- set: descriptor.set.bind(doc),
199
- };
200
- } else {
201
- properties[name] = {
202
- value: Doc.prototype[name].bind(doc),
203
- };
204
- }
205
- }
206
- Object.defineProperties(globalThis, properties);
207
-
208
- const functions = {
209
- dispatchEvent: app._dispatchEvent.bind(app),
210
- timeoutCb: app._evalCallback.bind(app),
211
- };
212
-
213
- return (name, args) => {
214
- try {
215
- functions[name](args);
216
- } catch (error) {
217
- const value = `${error.toString()}\n${error.stack}`;
218
- send({ command: "error", value });
219
- }
220
- };
221
- }
222
-
223
- export { initSandbox };
@@ -1,24 +0,0 @@
1
- /* Copyright 2020 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- class PDFObject {
17
- constructor(data) {
18
- this._expandos = Object.create(null);
19
- this._send = data.send || null;
20
- this._id = data.id || null;
21
- }
22
- }
23
-
24
- export { PDFObject };
@@ -1,146 +0,0 @@
1
- /* Copyright 2020 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- class PrintParams {
17
- constructor(data) {
18
- this.binaryOk = true;
19
- this.bitmapDPI = 150;
20
- this.booklet = {
21
- binding: 0,
22
- duplexMode: 0,
23
- subsetFrom: 0,
24
- subsetTo: -1,
25
- };
26
- this.colorOverride = 0;
27
- this.colorProfile = "";
28
- this.constants = Object.freeze({
29
- bookletBindings: Object.freeze({
30
- Left: 0,
31
- Right: 1,
32
- LeftTall: 2,
33
- RightTall: 3,
34
- }),
35
- bookletDuplexMode: Object.freeze({
36
- BothSides: 0,
37
- FrontSideOnly: 1,
38
- BasicSideOnly: 2,
39
- }),
40
- colorOverrides: Object.freeze({
41
- auto: 0,
42
- gray: 1,
43
- mono: 2,
44
- }),
45
- fontPolicies: Object.freeze({
46
- everyPage: 0,
47
- jobStart: 1,
48
- pageRange: 2,
49
- }),
50
- handling: Object.freeze({
51
- none: 0,
52
- fit: 1,
53
- shrink: 2,
54
- tileAll: 3,
55
- tileLarge: 4,
56
- nUp: 5,
57
- booklet: 6,
58
- }),
59
- interactionLevel: Object.freeze({
60
- automatic: 0,
61
- full: 1,
62
- silent: 2,
63
- }),
64
- nUpPageOrders: Object.freeze({
65
- Horizontal: 0,
66
- HorizontalReversed: 1,
67
- Vertical: 2,
68
- }),
69
- printContents: Object.freeze({
70
- doc: 0,
71
- docAndComments: 1,
72
- formFieldsOnly: 2,
73
- }),
74
- flagValues: Object.freeze({
75
- applyOverPrint: 1,
76
- applySoftProofSettings: 1 << 1,
77
- applyWorkingColorSpaces: 1 << 2,
78
- emitHalftones: 1 << 3,
79
- emitPostScriptXObjects: 1 << 4,
80
- emitFormsAsPSForms: 1 << 5,
81
- maxJP2KRes: 1 << 6,
82
- setPageSize: 1 << 7,
83
- suppressBG: 1 << 8,
84
- suppressCenter: 1 << 9,
85
- suppressCJKFontSubst: 1 << 10,
86
- suppressCropClip: 1 << 1,
87
- suppressRotate: 1 << 12,
88
- suppressTransfer: 1 << 13,
89
- suppressUCR: 1 << 14,
90
- useTrapAnnots: 1 << 15,
91
- usePrintersMarks: 1 << 16,
92
- }),
93
- rasterFlagValues: Object.freeze({
94
- textToOutline: 1,
95
- strokesToOutline: 1 << 1,
96
- allowComplexClip: 1 << 2,
97
- preserveOverprint: 1 << 3,
98
- }),
99
- subsets: Object.freeze({
100
- all: 0,
101
- even: 1,
102
- odd: 2,
103
- }),
104
- tileMarks: Object.freeze({
105
- none: 0,
106
- west: 1,
107
- east: 2,
108
- }),
109
- usages: Object.freeze({
110
- auto: 0,
111
- use: 1,
112
- noUse: 2,
113
- }),
114
- });
115
- this.downloadFarEastFonts = false;
116
- this.fileName = "";
117
- this.firstPage = 0;
118
- this.flags = 0;
119
- this.fontPolicy = 0;
120
- this.gradientDPI = 150;
121
- this.interactive = 1;
122
- this.lastPage = data.lastPage;
123
- this.npUpAutoRotate = false;
124
- this.npUpNumPagesH = 2;
125
- this.npUpNumPagesV = 2;
126
- this.npUpPageBorder = false;
127
- this.npUpPageOrder = 0;
128
- this.pageHandling = 0;
129
- this.pageSubset = 0;
130
- this.printAsImage = false;
131
- this.printContent = 0;
132
- this.printerName = "";
133
- this.psLevel = 0;
134
- this.rasterFlags = 0;
135
- this.reversePages = false;
136
- this.tileLabel = false;
137
- this.tileMark = 0;
138
- this.tileOverlap = 0;
139
- this.tileScale = 1.0;
140
- this.transparencyLevel = 75;
141
- this.usePrinterCRD = 0;
142
- this.useT1Conversion = 0;
143
- }
144
- }
145
-
146
- export { PrintParams };
@@ -1,139 +0,0 @@
1
- /* Copyright 2020 Mozilla Foundation
2
- *
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- *
7
- * http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software
10
- * distributed under the License is distributed on an "AS IS" BASIS,
11
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- * See the License for the specific language governing permissions and
13
- * limitations under the License.
14
- */
15
-
16
- class ProxyHandler {
17
- constructor() {
18
- // Don't dispatch an event for those properties.
19
- // - delay: allow to delay field redraw until delay is set to false.
20
- // Likely it's useless to implement that stuff.
21
- this.nosend = new Set(["delay"]);
22
- }
23
-
24
- get(obj, prop) {
25
- // script may add some properties to the object
26
- if (prop in obj._expandos) {
27
- const val = obj._expandos[prop];
28
- if (typeof val === "function") {
29
- return val.bind(obj);
30
- }
31
- return val;
32
- }
33
-
34
- if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {
35
- // return only public properties
36
- // i.e. the ones not starting with a '_'
37
- const val = obj[prop];
38
- if (typeof val === "function") {
39
- return val.bind(obj);
40
- }
41
- return val;
42
- }
43
-
44
- return undefined;
45
- }
46
-
47
- set(obj, prop, value) {
48
- if (obj._kidIds) {
49
- // If the field is a container for other fields then
50
- // dispatch the kids.
51
- obj._kidIds.forEach(id => {
52
- obj._appObjects[id].wrapped[prop] = value;
53
- });
54
- }
55
-
56
- if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {
57
- const old = obj[prop];
58
- obj[prop] = value;
59
- if (
60
- !this.nosend.has(prop) &&
61
- obj._send &&
62
- obj._id !== null &&
63
- typeof old !== "function"
64
- ) {
65
- const data = { id: obj._id };
66
- data[prop] = obj[prop];
67
-
68
- // send the updated value to the other side
69
- if (!obj._siblings) {
70
- obj._send(data);
71
- } else {
72
- data.siblings = obj._siblings;
73
- obj._send(data);
74
- }
75
- }
76
- } else {
77
- obj._expandos[prop] = value;
78
- }
79
- return true;
80
- }
81
-
82
- has(obj, prop) {
83
- return (
84
- prop in obj._expandos ||
85
- (typeof prop === "string" && !prop.startsWith("_") && prop in obj)
86
- );
87
- }
88
-
89
- getPrototypeOf(obj) {
90
- return null;
91
- }
92
-
93
- setPrototypeOf(obj, proto) {
94
- return false;
95
- }
96
-
97
- isExtensible(obj) {
98
- return true;
99
- }
100
-
101
- preventExtensions(obj) {
102
- return false;
103
- }
104
-
105
- getOwnPropertyDescriptor(obj, prop) {
106
- if (prop in obj._expandos) {
107
- return {
108
- configurable: true,
109
- enumerable: true,
110
- value: obj._expandos[prop],
111
- };
112
- }
113
-
114
- if (typeof prop === "string" && !prop.startsWith("_") && prop in obj) {
115
- return { configurable: true, enumerable: true, value: obj[prop] };
116
- }
117
-
118
- return undefined;
119
- }
120
-
121
- defineProperty(obj, key, descriptor) {
122
- Object.defineProperty(obj._expandos, key, descriptor);
123
- return true;
124
- }
125
-
126
- deleteProperty(obj, prop) {
127
- if (prop in obj._expandos) {
128
- delete obj._expandos[prop];
129
- }
130
- }
131
-
132
- ownKeys(obj) {
133
- const fromExpandos = Reflect.ownKeys(obj._expandos);
134
- const fromObj = Reflect.ownKeys(obj).filter(k => !k.startsWith("_"));
135
- return fromExpandos.concat(fromObj);
136
- }
137
- }
138
-
139
- export { ProxyHandler };