@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,221 +0,0 @@
1
- /* Copyright 2012 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 { FontType, info } from "../shared/util.js";
17
- import { getEncoding, StandardEncoding } from "./encodings.js";
18
- import { getGlyphsUnicode } from "./glyphlist.js";
19
- import { getUnicodeForGlyph } from "./unicode.js";
20
-
21
- // Accented characters have issues on Windows and Linux. When this flag is
22
- // enabled glyphs that use seac and seac style endchar operators are truncated
23
- // and we instead just store the glyph id's of the base glyph and its accent to
24
- // be drawn individually.
25
- // Linux (freetype) requires that when a seac style endchar is used
26
- // that the charset must be a predefined one, however we build a
27
- // custom one. Windows just refuses to draw glyphs with seac operators.
28
- const SEAC_ANALYSIS_ENABLED = true;
29
-
30
- const FontFlags = {
31
- FixedPitch: 1,
32
- Serif: 2,
33
- Symbolic: 4,
34
- Script: 8,
35
- Nonsymbolic: 32,
36
- Italic: 64,
37
- AllCap: 65536,
38
- SmallCap: 131072,
39
- ForceBold: 262144,
40
- };
41
-
42
- // prettier-ignore
43
- const MacStandardGlyphOrdering = [
44
- ".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl",
45
- "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft",
46
- "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash",
47
- "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
48
- "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at",
49
- "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
50
- "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft",
51
- "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b",
52
- "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
53
- "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright",
54
- "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde",
55
- "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis",
56
- "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis",
57
- "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve",
58
- "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex",
59
- "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet",
60
- "paragraph", "germandbls", "registered", "copyright", "trademark", "acute",
61
- "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal",
62
- "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi",
63
- "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash",
64
- "questiondown", "exclamdown", "logicalnot", "radical", "florin",
65
- "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis",
66
- "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash",
67
- "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright",
68
- "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency",
69
- "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered",
70
- "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex",
71
- "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex",
72
- "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute",
73
- "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron",
74
- "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron",
75
- "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar",
76
- "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply",
77
- "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter",
78
- "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla",
79
- "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
80
-
81
- function getFontType(type, subtype, isStandardFont = false) {
82
- switch (type) {
83
- case "Type1":
84
- if (isStandardFont) {
85
- return FontType.TYPE1STANDARD;
86
- }
87
- return subtype === "Type1C" ? FontType.TYPE1C : FontType.TYPE1;
88
- case "CIDFontType0":
89
- return subtype === "CIDFontType0C"
90
- ? FontType.CIDFONTTYPE0C
91
- : FontType.CIDFONTTYPE0;
92
- case "OpenType":
93
- return FontType.OPENTYPE;
94
- case "TrueType":
95
- return FontType.TRUETYPE;
96
- case "CIDFontType2":
97
- return FontType.CIDFONTTYPE2;
98
- case "MMType1":
99
- return FontType.MMTYPE1;
100
- case "Type0":
101
- return FontType.TYPE0;
102
- default:
103
- return FontType.UNKNOWN;
104
- }
105
- }
106
-
107
- // Some bad PDF generators, e.g. Scribus PDF, include glyph names
108
- // in a 'uniXXXX' format -- attempting to recover proper ones.
109
- function recoverGlyphName(name, glyphsUnicodeMap) {
110
- if (glyphsUnicodeMap[name] !== undefined) {
111
- return name;
112
- }
113
- // The glyph name is non-standard, trying to recover.
114
- const unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
115
- if (unicode !== -1) {
116
- for (const key in glyphsUnicodeMap) {
117
- if (glyphsUnicodeMap[key] === unicode) {
118
- return key;
119
- }
120
- }
121
- }
122
- info("Unable to recover a standard glyph name for: " + name);
123
- return name;
124
- }
125
-
126
- /**
127
- * Shared logic for building a char code to glyph id mapping for Type1 and
128
- * simple CFF fonts. See section 9.6.6.2 of the spec.
129
- * @param {Object} properties Font properties object.
130
- * @param {Object} builtInEncoding The encoding contained within the actual font
131
- * data.
132
- * @param {Array} glyphNames Array of glyph names where the index is the
133
- * glyph ID.
134
- * @returns {Object} A char code to glyph ID map.
135
- */
136
- function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
137
- const charCodeToGlyphId = Object.create(null);
138
- let glyphId, charCode, baseEncoding;
139
- const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
140
-
141
- if (properties.isInternalFont) {
142
- baseEncoding = builtInEncoding;
143
- for (charCode = 0; charCode < baseEncoding.length; charCode++) {
144
- glyphId = glyphNames.indexOf(baseEncoding[charCode]);
145
- if (glyphId >= 0) {
146
- charCodeToGlyphId[charCode] = glyphId;
147
- } else {
148
- charCodeToGlyphId[charCode] = 0; // notdef
149
- }
150
- }
151
- } else if (properties.baseEncodingName) {
152
- // If a valid base encoding name was used, the mapping is initialized with
153
- // that.
154
- baseEncoding = getEncoding(properties.baseEncodingName);
155
- for (charCode = 0; charCode < baseEncoding.length; charCode++) {
156
- glyphId = glyphNames.indexOf(baseEncoding[charCode]);
157
- if (glyphId >= 0) {
158
- charCodeToGlyphId[charCode] = glyphId;
159
- } else {
160
- charCodeToGlyphId[charCode] = 0; // notdef
161
- }
162
- }
163
- } else if (isSymbolicFont) {
164
- // For a symbolic font the encoding should be the fonts built-in encoding.
165
- for (charCode in builtInEncoding) {
166
- charCodeToGlyphId[charCode] = builtInEncoding[charCode];
167
- }
168
- } else {
169
- // For non-symbolic fonts that don't have a base encoding the standard
170
- // encoding should be used.
171
- baseEncoding = StandardEncoding;
172
- for (charCode = 0; charCode < baseEncoding.length; charCode++) {
173
- glyphId = glyphNames.indexOf(baseEncoding[charCode]);
174
- if (glyphId >= 0) {
175
- charCodeToGlyphId[charCode] = glyphId;
176
- } else {
177
- charCodeToGlyphId[charCode] = 0; // notdef
178
- }
179
- }
180
- }
181
-
182
- // Lastly, merge in the differences.
183
- const differences = properties.differences;
184
- let glyphsUnicodeMap;
185
- if (differences) {
186
- for (charCode in differences) {
187
- const glyphName = differences[charCode];
188
- glyphId = glyphNames.indexOf(glyphName);
189
-
190
- if (glyphId === -1) {
191
- if (!glyphsUnicodeMap) {
192
- glyphsUnicodeMap = getGlyphsUnicode();
193
- }
194
- const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
195
- if (standardGlyphName !== glyphName) {
196
- glyphId = glyphNames.indexOf(standardGlyphName);
197
- }
198
- }
199
- if (glyphId >= 0) {
200
- charCodeToGlyphId[charCode] = glyphId;
201
- } else {
202
- charCodeToGlyphId[charCode] = 0; // notdef
203
- }
204
- }
205
- }
206
- return charCodeToGlyphId;
207
- }
208
-
209
- function normalizeFontName(name) {
210
- return name.replace(/[,_]/g, "-").replace(/\s/g, "");
211
- }
212
-
213
- export {
214
- FontFlags,
215
- getFontType,
216
- MacStandardGlyphOrdering,
217
- normalizeFontName,
218
- recoverGlyphName,
219
- SEAC_ANALYSIS_ENABLED,
220
- type1FontGlyphMapping,
221
- };