@divriots/pdfjs-dist 3.10.111-divriots2.0

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 (305) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/LICENSE +177 -0
  3. package/README.md +14 -0
  4. package/build/pdf.js +18009 -0
  5. package/build/pdf.js.map +1 -0
  6. package/build/pdf.min.js +22 -0
  7. package/build/pdf.sandbox.js +280 -0
  8. package/build/pdf.sandbox.js.map +1 -0
  9. package/build/pdf.sandbox.min.js +22 -0
  10. package/build/pdf.worker.entry.js +19 -0
  11. package/build/pdf.worker.js +57863 -0
  12. package/build/pdf.worker.js.map +1 -0
  13. package/build/pdf.worker.min.js +22 -0
  14. package/cmaps/78-EUC-H.bcmap +0 -0
  15. package/cmaps/78-EUC-V.bcmap +0 -0
  16. package/cmaps/78-H.bcmap +0 -0
  17. package/cmaps/78-RKSJ-H.bcmap +0 -0
  18. package/cmaps/78-RKSJ-V.bcmap +0 -0
  19. package/cmaps/78-V.bcmap +0 -0
  20. package/cmaps/78ms-RKSJ-H.bcmap +0 -0
  21. package/cmaps/78ms-RKSJ-V.bcmap +0 -0
  22. package/cmaps/83pv-RKSJ-H.bcmap +0 -0
  23. package/cmaps/90ms-RKSJ-H.bcmap +0 -0
  24. package/cmaps/90ms-RKSJ-V.bcmap +0 -0
  25. package/cmaps/90msp-RKSJ-H.bcmap +0 -0
  26. package/cmaps/90msp-RKSJ-V.bcmap +0 -0
  27. package/cmaps/90pv-RKSJ-H.bcmap +0 -0
  28. package/cmaps/90pv-RKSJ-V.bcmap +0 -0
  29. package/cmaps/Add-H.bcmap +0 -0
  30. package/cmaps/Add-RKSJ-H.bcmap +0 -0
  31. package/cmaps/Add-RKSJ-V.bcmap +0 -0
  32. package/cmaps/Add-V.bcmap +0 -0
  33. package/cmaps/Adobe-CNS1-0.bcmap +0 -0
  34. package/cmaps/Adobe-CNS1-1.bcmap +0 -0
  35. package/cmaps/Adobe-CNS1-2.bcmap +0 -0
  36. package/cmaps/Adobe-CNS1-3.bcmap +0 -0
  37. package/cmaps/Adobe-CNS1-4.bcmap +0 -0
  38. package/cmaps/Adobe-CNS1-5.bcmap +0 -0
  39. package/cmaps/Adobe-CNS1-6.bcmap +0 -0
  40. package/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  41. package/cmaps/Adobe-GB1-0.bcmap +0 -0
  42. package/cmaps/Adobe-GB1-1.bcmap +0 -0
  43. package/cmaps/Adobe-GB1-2.bcmap +0 -0
  44. package/cmaps/Adobe-GB1-3.bcmap +0 -0
  45. package/cmaps/Adobe-GB1-4.bcmap +0 -0
  46. package/cmaps/Adobe-GB1-5.bcmap +0 -0
  47. package/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  48. package/cmaps/Adobe-Japan1-0.bcmap +0 -0
  49. package/cmaps/Adobe-Japan1-1.bcmap +0 -0
  50. package/cmaps/Adobe-Japan1-2.bcmap +0 -0
  51. package/cmaps/Adobe-Japan1-3.bcmap +0 -0
  52. package/cmaps/Adobe-Japan1-4.bcmap +0 -0
  53. package/cmaps/Adobe-Japan1-5.bcmap +0 -0
  54. package/cmaps/Adobe-Japan1-6.bcmap +0 -0
  55. package/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  56. package/cmaps/Adobe-Korea1-0.bcmap +0 -0
  57. package/cmaps/Adobe-Korea1-1.bcmap +0 -0
  58. package/cmaps/Adobe-Korea1-2.bcmap +0 -0
  59. package/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  60. package/cmaps/B5-H.bcmap +0 -0
  61. package/cmaps/B5-V.bcmap +0 -0
  62. package/cmaps/B5pc-H.bcmap +0 -0
  63. package/cmaps/B5pc-V.bcmap +0 -0
  64. package/cmaps/CNS-EUC-H.bcmap +0 -0
  65. package/cmaps/CNS-EUC-V.bcmap +0 -0
  66. package/cmaps/CNS1-H.bcmap +0 -0
  67. package/cmaps/CNS1-V.bcmap +0 -0
  68. package/cmaps/CNS2-H.bcmap +0 -0
  69. package/cmaps/CNS2-V.bcmap +3 -0
  70. package/cmaps/ETHK-B5-H.bcmap +0 -0
  71. package/cmaps/ETHK-B5-V.bcmap +0 -0
  72. package/cmaps/ETen-B5-H.bcmap +0 -0
  73. package/cmaps/ETen-B5-V.bcmap +0 -0
  74. package/cmaps/ETenms-B5-H.bcmap +3 -0
  75. package/cmaps/ETenms-B5-V.bcmap +0 -0
  76. package/cmaps/EUC-H.bcmap +0 -0
  77. package/cmaps/EUC-V.bcmap +0 -0
  78. package/cmaps/Ext-H.bcmap +0 -0
  79. package/cmaps/Ext-RKSJ-H.bcmap +0 -0
  80. package/cmaps/Ext-RKSJ-V.bcmap +0 -0
  81. package/cmaps/Ext-V.bcmap +0 -0
  82. package/cmaps/GB-EUC-H.bcmap +0 -0
  83. package/cmaps/GB-EUC-V.bcmap +0 -0
  84. package/cmaps/GB-H.bcmap +4 -0
  85. package/cmaps/GB-V.bcmap +0 -0
  86. package/cmaps/GBK-EUC-H.bcmap +0 -0
  87. package/cmaps/GBK-EUC-V.bcmap +0 -0
  88. package/cmaps/GBK2K-H.bcmap +0 -0
  89. package/cmaps/GBK2K-V.bcmap +0 -0
  90. package/cmaps/GBKp-EUC-H.bcmap +0 -0
  91. package/cmaps/GBKp-EUC-V.bcmap +0 -0
  92. package/cmaps/GBT-EUC-H.bcmap +0 -0
  93. package/cmaps/GBT-EUC-V.bcmap +0 -0
  94. package/cmaps/GBT-H.bcmap +0 -0
  95. package/cmaps/GBT-V.bcmap +0 -0
  96. package/cmaps/GBTpc-EUC-H.bcmap +0 -0
  97. package/cmaps/GBTpc-EUC-V.bcmap +0 -0
  98. package/cmaps/GBpc-EUC-H.bcmap +0 -0
  99. package/cmaps/GBpc-EUC-V.bcmap +0 -0
  100. package/cmaps/H.bcmap +0 -0
  101. package/cmaps/HKdla-B5-H.bcmap +0 -0
  102. package/cmaps/HKdla-B5-V.bcmap +0 -0
  103. package/cmaps/HKdlb-B5-H.bcmap +0 -0
  104. package/cmaps/HKdlb-B5-V.bcmap +0 -0
  105. package/cmaps/HKgccs-B5-H.bcmap +0 -0
  106. package/cmaps/HKgccs-B5-V.bcmap +0 -0
  107. package/cmaps/HKm314-B5-H.bcmap +0 -0
  108. package/cmaps/HKm314-B5-V.bcmap +0 -0
  109. package/cmaps/HKm471-B5-H.bcmap +0 -0
  110. package/cmaps/HKm471-B5-V.bcmap +0 -0
  111. package/cmaps/HKscs-B5-H.bcmap +0 -0
  112. package/cmaps/HKscs-B5-V.bcmap +0 -0
  113. package/cmaps/Hankaku.bcmap +0 -0
  114. package/cmaps/Hiragana.bcmap +0 -0
  115. package/cmaps/KSC-EUC-H.bcmap +0 -0
  116. package/cmaps/KSC-EUC-V.bcmap +0 -0
  117. package/cmaps/KSC-H.bcmap +0 -0
  118. package/cmaps/KSC-Johab-H.bcmap +0 -0
  119. package/cmaps/KSC-Johab-V.bcmap +0 -0
  120. package/cmaps/KSC-V.bcmap +0 -0
  121. package/cmaps/KSCms-UHC-H.bcmap +0 -0
  122. package/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  123. package/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  124. package/cmaps/KSCms-UHC-V.bcmap +0 -0
  125. package/cmaps/KSCpc-EUC-H.bcmap +0 -0
  126. package/cmaps/KSCpc-EUC-V.bcmap +0 -0
  127. package/cmaps/Katakana.bcmap +0 -0
  128. package/cmaps/LICENSE +36 -0
  129. package/cmaps/NWP-H.bcmap +0 -0
  130. package/cmaps/NWP-V.bcmap +0 -0
  131. package/cmaps/RKSJ-H.bcmap +0 -0
  132. package/cmaps/RKSJ-V.bcmap +0 -0
  133. package/cmaps/Roman.bcmap +0 -0
  134. package/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  135. package/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  136. package/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  137. package/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  138. package/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  139. package/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  140. package/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  141. package/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  142. package/cmaps/UniGB-UCS2-H.bcmap +0 -0
  143. package/cmaps/UniGB-UCS2-V.bcmap +0 -0
  144. package/cmaps/UniGB-UTF16-H.bcmap +0 -0
  145. package/cmaps/UniGB-UTF16-V.bcmap +0 -0
  146. package/cmaps/UniGB-UTF32-H.bcmap +0 -0
  147. package/cmaps/UniGB-UTF32-V.bcmap +0 -0
  148. package/cmaps/UniGB-UTF8-H.bcmap +0 -0
  149. package/cmaps/UniGB-UTF8-V.bcmap +0 -0
  150. package/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  151. package/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  152. package/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  153. package/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  154. package/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  155. package/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  156. package/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  157. package/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  158. package/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  159. package/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  160. package/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  161. package/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  162. package/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  163. package/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  164. package/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  165. package/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  166. package/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  167. package/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  168. package/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  169. package/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  170. package/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  171. package/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  172. package/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  173. package/cmaps/UniKS-UCS2-H.bcmap +0 -0
  174. package/cmaps/UniKS-UCS2-V.bcmap +0 -0
  175. package/cmaps/UniKS-UTF16-H.bcmap +0 -0
  176. package/cmaps/UniKS-UTF16-V.bcmap +0 -0
  177. package/cmaps/UniKS-UTF32-H.bcmap +0 -0
  178. package/cmaps/UniKS-UTF32-V.bcmap +0 -0
  179. package/cmaps/UniKS-UTF8-H.bcmap +0 -0
  180. package/cmaps/UniKS-UTF8-V.bcmap +0 -0
  181. package/cmaps/V.bcmap +0 -0
  182. package/cmaps/WP-Symbol.bcmap +0 -0
  183. package/image_decoders/pdf.image_decoders.js +7490 -0
  184. package/image_decoders/pdf.image_decoders.js.map +1 -0
  185. package/image_decoders/pdf.image_decoders.min.js +22 -0
  186. package/legacy/build/pdf.d.ts +1 -0
  187. package/legacy/build/pdf.js +22941 -0
  188. package/legacy/build/pdf.js.map +1 -0
  189. package/legacy/build/pdf.min.js +22 -0
  190. package/legacy/build/pdf.sandbox.js +3274 -0
  191. package/legacy/build/pdf.sandbox.js.map +1 -0
  192. package/legacy/build/pdf.sandbox.min.js +22 -0
  193. package/legacy/build/pdf.worker.entry.js +19 -0
  194. package/legacy/build/pdf.worker.js +62058 -0
  195. package/legacy/build/pdf.worker.js.map +1 -0
  196. package/legacy/build/pdf.worker.min.js +22 -0
  197. package/legacy/image_decoders/pdf.image_decoders.js +10615 -0
  198. package/legacy/image_decoders/pdf.image_decoders.js.map +1 -0
  199. package/legacy/image_decoders/pdf.image_decoders.min.js +22 -0
  200. package/legacy/web/images/annotation-check.svg +11 -0
  201. package/legacy/web/images/annotation-comment.svg +16 -0
  202. package/legacy/web/images/annotation-help.svg +26 -0
  203. package/legacy/web/images/annotation-insert.svg +10 -0
  204. package/legacy/web/images/annotation-key.svg +11 -0
  205. package/legacy/web/images/annotation-newparagraph.svg +11 -0
  206. package/legacy/web/images/annotation-noicon.svg +7 -0
  207. package/legacy/web/images/annotation-note.svg +42 -0
  208. package/legacy/web/images/annotation-paperclip.svg +6 -0
  209. package/legacy/web/images/annotation-paragraph.svg +16 -0
  210. package/legacy/web/images/annotation-pushpin.svg +7 -0
  211. package/legacy/web/images/loading-icon.gif +0 -0
  212. package/legacy/web/pdf_viewer.css +1375 -0
  213. package/legacy/web/pdf_viewer.d.ts +1 -0
  214. package/legacy/web/pdf_viewer.js +10502 -0
  215. package/legacy/web/pdf_viewer.js.map +1 -0
  216. package/package.json +35 -0
  217. package/standard_fonts/FoxitDingbats.pfb +0 -0
  218. package/standard_fonts/FoxitFixed.pfb +0 -0
  219. package/standard_fonts/FoxitFixedBold.pfb +0 -0
  220. package/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  221. package/standard_fonts/FoxitFixedItalic.pfb +0 -0
  222. package/standard_fonts/FoxitSerif.pfb +0 -0
  223. package/standard_fonts/FoxitSerifBold.pfb +0 -0
  224. package/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  225. package/standard_fonts/FoxitSerifItalic.pfb +0 -0
  226. package/standard_fonts/FoxitSymbol.pfb +0 -0
  227. package/standard_fonts/LICENSE_FOXIT +27 -0
  228. package/standard_fonts/LICENSE_LIBERATION +102 -0
  229. package/standard_fonts/LiberationSans-Bold.ttf +0 -0
  230. package/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  231. package/standard_fonts/LiberationSans-Italic.ttf +0 -0
  232. package/standard_fonts/LiberationSans-Regular.ttf +0 -0
  233. package/types/external/webL10n/l10n.d.ts +0 -0
  234. package/types/src/display/annotation_layer.d.ts +203 -0
  235. package/types/src/display/annotation_storage.d.ts +89 -0
  236. package/types/src/display/api.d.ts +1592 -0
  237. package/types/src/display/base_factory.d.ts +54 -0
  238. package/types/src/display/canvas.d.ts +208 -0
  239. package/types/src/display/display_utils.d.ts +277 -0
  240. package/types/src/display/editor/annotation_editor_layer.d.ts +196 -0
  241. package/types/src/display/editor/editor.d.ts +325 -0
  242. package/types/src/display/editor/freetext.d.ts +72 -0
  243. package/types/src/display/editor/ink.d.ts +95 -0
  244. package/types/src/display/editor/stamp.d.ts +28 -0
  245. package/types/src/display/editor/tools.d.ts +349 -0
  246. package/types/src/display/font_loader.d.ts +43 -0
  247. package/types/src/display/metadata.d.ts +11 -0
  248. package/types/src/display/optional_content_config.d.ts +13 -0
  249. package/types/src/display/pattern_helper.d.ts +73 -0
  250. package/types/src/display/text_layer.d.ts +151 -0
  251. package/types/src/display/transport_stream.d.ts +68 -0
  252. package/types/src/display/worker_options.d.ts +27 -0
  253. package/types/src/display/xfa_layer.d.ts +46 -0
  254. package/types/src/display/xfa_text.d.ts +19 -0
  255. package/types/src/pdf.d.ts +62 -0
  256. package/types/src/shared/image_utils.d.ts +17 -0
  257. package/types/src/shared/message_handler.d.ts +43 -0
  258. package/types/src/shared/murmurhash3.d.ts +7 -0
  259. package/types/src/shared/scripting_utils.d.ts +16 -0
  260. package/types/src/shared/util.d.ts +398 -0
  261. package/types/web/annotation_editor_layer_builder.d.ts +50 -0
  262. package/types/web/annotation_layer_builder.d.ts +83 -0
  263. package/types/web/app_options.d.ts +14 -0
  264. package/types/web/download_manager.d.ts +14 -0
  265. package/types/web/event_utils.d.ts +75 -0
  266. package/types/web/generic_scripting.d.ts +8 -0
  267. package/types/web/genericl10n.d.ts +13 -0
  268. package/types/web/interfaces.d.ts +163 -0
  269. package/types/web/l10n_utils.d.ts +7 -0
  270. package/types/web/pdf_find_controller.d.ts +108 -0
  271. package/types/web/pdf_find_utils.d.ts +16 -0
  272. package/types/web/pdf_history.d.ts +168 -0
  273. package/types/web/pdf_link_service.d.ts +243 -0
  274. package/types/web/pdf_page_view.d.ts +209 -0
  275. package/types/web/pdf_rendering_queue.d.ts +53 -0
  276. package/types/web/pdf_scripting_manager.component.d.ts +5 -0
  277. package/types/web/pdf_scripting_manager.d.ts +61 -0
  278. package/types/web/pdf_single_page_viewer.d.ts +7 -0
  279. package/types/web/pdf_thumbnail_view.d.ts +131 -0
  280. package/types/web/pdf_thumbnail_viewer.d.ts +104 -0
  281. package/types/web/pdf_viewer.component.d.ts +24 -0
  282. package/types/web/pdf_viewer.d.ts +455 -0
  283. package/types/web/struct_tree_layer_builder.d.ts +7 -0
  284. package/types/web/text_accessibility.d.ts +42 -0
  285. package/types/web/text_highlighter.d.ts +63 -0
  286. package/types/web/text_layer_builder.d.ts +64 -0
  287. package/types/web/ui_utils.d.ts +288 -0
  288. package/types/web/xfa_layer_builder.d.ts +41 -0
  289. package/web/images/annotation-check.svg +11 -0
  290. package/web/images/annotation-comment.svg +16 -0
  291. package/web/images/annotation-help.svg +26 -0
  292. package/web/images/annotation-insert.svg +10 -0
  293. package/web/images/annotation-key.svg +11 -0
  294. package/web/images/annotation-newparagraph.svg +11 -0
  295. package/web/images/annotation-noicon.svg +7 -0
  296. package/web/images/annotation-note.svg +42 -0
  297. package/web/images/annotation-paperclip.svg +6 -0
  298. package/web/images/annotation-paragraph.svg +16 -0
  299. package/web/images/annotation-pushpin.svg +7 -0
  300. package/web/images/loading-icon.gif +0 -0
  301. package/web/pdf_viewer.css +1375 -0
  302. package/web/pdf_viewer.d.ts +1 -0
  303. package/web/pdf_viewer.js +7752 -0
  304. package/web/pdf_viewer.js.map +1 -0
  305. package/webpack.js +26 -0
@@ -0,0 +1,1592 @@
1
+ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
2
+ export type BinaryData = TypedArray | ArrayBuffer | Array<number> | string;
3
+ export type RefProxy = {
4
+ num: number;
5
+ gen: number;
6
+ };
7
+ /**
8
+ * Document initialization / loading parameters object.
9
+ */
10
+ export type DocumentInitParameters = {
11
+ /**
12
+ * - The URL of the PDF.
13
+ */
14
+ url?: string | URL | undefined;
15
+ /**
16
+ * - Binary PDF data.
17
+ * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
18
+ * BASE64-encoded, use `atob()` to convert it to a binary string first.
19
+ *
20
+ * NOTE: If TypedArrays are used they will generally be transferred to the
21
+ * worker-thread. This will help reduce main-thread memory usage, however
22
+ * it will take ownership of the TypedArrays.
23
+ */
24
+ data?: BinaryData | undefined;
25
+ /**
26
+ * - Basic authentication headers.
27
+ */
28
+ httpHeaders?: Object | undefined;
29
+ /**
30
+ * - Indicates whether or not
31
+ * cross-site Access-Control requests should be made using credentials such
32
+ * as cookies or authorization headers. The default is `false`.
33
+ */
34
+ withCredentials?: boolean | undefined;
35
+ /**
36
+ * - For decrypting password-protected PDFs.
37
+ */
38
+ password?: string | undefined;
39
+ /**
40
+ * - The PDF file length. It's used for progress
41
+ * reports and range requests operations.
42
+ */
43
+ length?: number | undefined;
44
+ /**
45
+ * - Allows for using a custom range
46
+ * transport implementation.
47
+ */
48
+ range?: PDFDataRangeTransport | undefined;
49
+ /**
50
+ * - Specify maximum number of bytes fetched
51
+ * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE }.
52
+ */
53
+ rangeChunkSize?: number | undefined;
54
+ /**
55
+ * - The worker that will be used for loading and
56
+ * parsing the PDF data.
57
+ */
58
+ worker?: PDFWorker | undefined;
59
+ /**
60
+ * - Controls the logging level; the constants
61
+ * from {@link VerbosityLevel } should be used.
62
+ */
63
+ verbosity?: number | undefined;
64
+ /**
65
+ * - The base URL of the document, used when
66
+ * attempting to recover valid absolute URLs for annotations, and outline
67
+ * items, that (incorrectly) only specify relative URLs.
68
+ */
69
+ docBaseUrl?: string | undefined;
70
+ /**
71
+ * - The URL where the predefined Adobe CMaps are
72
+ * located. Include the trailing slash.
73
+ */
74
+ cMapUrl?: string | undefined;
75
+ /**
76
+ * - Specifies if the Adobe CMaps are binary
77
+ * packed or not. The default value is `true`.
78
+ */
79
+ cMapPacked?: boolean | undefined;
80
+ /**
81
+ * - The factory that will be used when
82
+ * reading built-in CMap files. Providing a custom factory is useful for
83
+ * environments without Fetch API or `XMLHttpRequest` support, such as
84
+ * Node.js. The default value is {DOMCMapReaderFactory}.
85
+ */
86
+ CMapReaderFactory?: Object | undefined;
87
+ /**
88
+ * - When `true`, fonts that aren't
89
+ * embedded in the PDF document will fallback to a system font.
90
+ * The default value is `true` in web environments and `false` in Node.js;
91
+ * unless `disableFontFace === true` in which case this defaults to `false`
92
+ * regardless of the environment (to prevent completely broken fonts).
93
+ */
94
+ useSystemFonts?: boolean | undefined;
95
+ /**
96
+ * - The URL where the standard font
97
+ * files are located. Include the trailing slash.
98
+ */
99
+ standardFontDataUrl?: string | undefined;
100
+ /**
101
+ * - The factory that will be used
102
+ * when reading the standard font files. Providing a custom factory is useful
103
+ * for environments without Fetch API or `XMLHttpRequest` support, such as
104
+ * Node.js. The default value is {DOMStandardFontDataFactory}.
105
+ */
106
+ StandardFontDataFactory?: Object | undefined;
107
+ /**
108
+ * - Enable using the Fetch API in the
109
+ * worker-thread when reading CMap and standard font files. When `true`,
110
+ * the `CMapReaderFactory` and `StandardFontDataFactory` options are ignored.
111
+ * The default value is `true` in web environments and `false` in Node.js.
112
+ */
113
+ useWorkerFetch?: boolean | undefined;
114
+ /**
115
+ * - Reject certain promises, e.g.
116
+ * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
117
+ * PDF data cannot be successfully parsed, instead of attempting to recover
118
+ * whatever possible of the data. The default value is `false`.
119
+ */
120
+ stopAtErrors?: boolean | undefined;
121
+ /**
122
+ * - The maximum allowed image size in total
123
+ * pixels, i.e. width * height. Images above this value will not be rendered.
124
+ * Use -1 for no limit, which is also the default value.
125
+ */
126
+ maxImageSize?: number | undefined;
127
+ /**
128
+ * - Determines if we can evaluate strings
129
+ * as JavaScript. Primarily used to improve performance of font rendering, and
130
+ * when parsing PDF functions. The default value is `true`.
131
+ */
132
+ isEvalSupported?: boolean | undefined;
133
+ /**
134
+ * - Determines if we can use
135
+ * `OffscreenCanvas` in the worker. Primarily used to improve performance of
136
+ * image conversion/rendering.
137
+ * The default value is `true` in web environments and `false` in Node.js.
138
+ */
139
+ isOffscreenCanvasSupported?: boolean | undefined;
140
+ /**
141
+ * - The integer value is used to
142
+ * know when an image must be resized (uses `OffscreenCanvas` in the worker).
143
+ * If it's -1 then a possibly slow algorithm is used to guess the max value.
144
+ */
145
+ canvasMaxAreaInBytes?: number | undefined;
146
+ /**
147
+ * - By default fonts are converted to
148
+ * OpenType fonts and loaded via the Font Loading API or `@font-face` rules.
149
+ * If disabled, fonts will be rendered using a built-in font renderer that
150
+ * constructs the glyphs with primitive path commands.
151
+ * The default value is `false` in web environments and `true` in Node.js.
152
+ */
153
+ disableFontFace?: boolean | undefined;
154
+ /**
155
+ * - Include additional properties,
156
+ * which are unused during rendering of PDF documents, when exporting the
157
+ * parsed font data from the worker-thread. This may be useful for debugging
158
+ * purposes (and backwards compatibility), but note that it will lead to
159
+ * increased memory usage. The default value is `false`.
160
+ */
161
+ fontExtraProperties?: boolean | undefined;
162
+ /**
163
+ * - Render Xfa forms if any.
164
+ * The default value is `false`.
165
+ */
166
+ enableXfa?: boolean | undefined;
167
+ /**
168
+ * - Specify an explicit document
169
+ * context to create elements with and to load resources, such as fonts,
170
+ * into. Defaults to the current document.
171
+ */
172
+ ownerDocument?: HTMLDocument | undefined;
173
+ /**
174
+ * - Disable range request loading of PDF
175
+ * files. When enabled, and if the server supports partial content requests,
176
+ * then the PDF will be fetched in chunks. The default value is `false`.
177
+ */
178
+ disableRange?: boolean | undefined;
179
+ /**
180
+ * - Disable streaming of PDF file data.
181
+ * By default PDF.js attempts to load PDF files in chunks. The default value
182
+ * is `false`.
183
+ */
184
+ disableStream?: boolean | undefined;
185
+ /**
186
+ * - Disable pre-fetching of PDF file
187
+ * data. When range requests are enabled PDF.js will automatically keep
188
+ * fetching more data even if it isn't needed to display the current page.
189
+ * The default value is `false`.
190
+ *
191
+ * NOTE: It is also necessary to disable streaming, see above, in order for
192
+ * disabling of pre-fetching to work correctly.
193
+ */
194
+ disableAutoFetch?: boolean | undefined;
195
+ /**
196
+ * - Enables special hooks for debugging PDF.js
197
+ * (see `web/debugger.js`). The default value is `false`.
198
+ */
199
+ pdfBug?: boolean | undefined;
200
+ /**
201
+ * - The factory instance that will be used
202
+ * when creating canvases. The default value is {new DOMCanvasFactory()}.
203
+ */
204
+ canvasFactory?: Object | undefined;
205
+ /**
206
+ * - A factory instance that will be used
207
+ * to create SVG filters when rendering some images on the main canvas.
208
+ */
209
+ filterFactory?: Object | undefined;
210
+ };
211
+ export type OnProgressParameters = {
212
+ /**
213
+ * - Currently loaded number of bytes.
214
+ */
215
+ loaded: number;
216
+ /**
217
+ * - Total number of bytes in the PDF file.
218
+ */
219
+ total: number;
220
+ };
221
+ /**
222
+ * Page getViewport parameters.
223
+ */
224
+ export type GetViewportParameters = {
225
+ /**
226
+ * - The desired scale of the viewport.
227
+ */
228
+ scale: number;
229
+ /**
230
+ * - The desired rotation, in degrees, of
231
+ * the viewport. If omitted it defaults to the page rotation.
232
+ */
233
+ rotation?: number | undefined;
234
+ /**
235
+ * - The horizontal, i.e. x-axis, offset.
236
+ * The default value is `0`.
237
+ */
238
+ offsetX?: number | undefined;
239
+ /**
240
+ * - The vertical, i.e. y-axis, offset.
241
+ * The default value is `0`.
242
+ */
243
+ offsetY?: number | undefined;
244
+ /**
245
+ * - If true, the y-axis will not be
246
+ * flipped. The default value is `false`.
247
+ */
248
+ dontFlip?: boolean | undefined;
249
+ };
250
+ /**
251
+ * Page getTextContent parameters.
252
+ */
253
+ export type getTextContentParameters = {
254
+ /**
255
+ * - When true include marked
256
+ * content items in the items array of TextContent. The default is `false`.
257
+ */
258
+ includeMarkedContent?: boolean | undefined;
259
+ /**
260
+ * - When true the text is *not*
261
+ * normalized in the worker-thread. The default is `false`.
262
+ */
263
+ disableNormalization?: boolean | undefined;
264
+ };
265
+ /**
266
+ * Page text content.
267
+ */
268
+ export type TextContent = {
269
+ /**
270
+ * - Array of
271
+ * {@link TextItem } and {@link TextMarkedContent } objects. TextMarkedContent
272
+ * items are included when includeMarkedContent is true.
273
+ */
274
+ items: Array<TextItem | TextMarkedContent>;
275
+ /**
276
+ * - {@link TextStyle } objects,
277
+ * indexed by font name.
278
+ */
279
+ styles: {
280
+ [x: string]: TextStyle;
281
+ };
282
+ };
283
+ /**
284
+ * Page text content part.
285
+ */
286
+ export type TextItem = {
287
+ /**
288
+ * - Text content.
289
+ */
290
+ str: string;
291
+ /**
292
+ * - Text direction: 'ttb', 'ltr' or 'rtl'.
293
+ */
294
+ dir: string;
295
+ /**
296
+ * - Transformation matrix.
297
+ */
298
+ transform: Array<any>;
299
+ /**
300
+ * - Width in device space.
301
+ */
302
+ width: number;
303
+ /**
304
+ * - Height in device space.
305
+ */
306
+ height: number;
307
+ /**
308
+ * - Font name used by PDF.js for converted font.
309
+ */
310
+ fontName: string;
311
+ /**
312
+ * - Indicating if the text content is followed by a
313
+ * line-break.
314
+ */
315
+ hasEOL: boolean;
316
+ };
317
+ /**
318
+ * Page text marked content part.
319
+ */
320
+ export type TextMarkedContent = {
321
+ /**
322
+ * - Either 'beginMarkedContent',
323
+ * 'beginMarkedContentProps', or 'endMarkedContent'.
324
+ */
325
+ type: string;
326
+ /**
327
+ * - The marked content identifier. Only used for type
328
+ * 'beginMarkedContentProps'.
329
+ */
330
+ id: string;
331
+ };
332
+ /**
333
+ * Text style.
334
+ */
335
+ export type TextStyle = {
336
+ /**
337
+ * - Font ascent.
338
+ */
339
+ ascent: number;
340
+ /**
341
+ * - Font descent.
342
+ */
343
+ descent: number;
344
+ /**
345
+ * - Whether or not the text is in vertical mode.
346
+ */
347
+ vertical: boolean;
348
+ /**
349
+ * - The possible font family.
350
+ */
351
+ fontFamily: string;
352
+ };
353
+ /**
354
+ * Page annotation parameters.
355
+ */
356
+ export type GetAnnotationsParameters = {
357
+ /**
358
+ * - Determines the annotations that are fetched,
359
+ * can be 'display' (viewable annotations), 'print' (printable annotations),
360
+ * or 'any' (all annotations). The default value is 'display'.
361
+ */
362
+ intent?: string | undefined;
363
+ };
364
+ /**
365
+ * Page render parameters.
366
+ */
367
+ export type RenderParameters = {
368
+ /**
369
+ * - A 2D context of a DOM
370
+ * Canvas object.
371
+ */
372
+ canvasContext: CanvasRenderingContext2D;
373
+ /**
374
+ * - Rendering viewport obtained by calling
375
+ * the `PDFPageProxy.getViewport` method.
376
+ */
377
+ viewport: PageViewport;
378
+ /**
379
+ * - Rendering intent, can be 'display', 'print',
380
+ * or 'any'. The default value is 'display'.
381
+ */
382
+ intent?: string | undefined;
383
+ /**
384
+ * Controls which annotations are rendered
385
+ * onto the canvas, for annotations with appearance-data; the values from
386
+ * {@link AnnotationMode } should be used. The following values are supported:
387
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
388
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
389
+ * it also depends on the `intent`-option, see above).
390
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
391
+ * interactive form elements (those will be rendered in the display layer).
392
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
393
+ * (as above) but where interactive form elements are updated with data
394
+ * from the {@link AnnotationStorage }-instance; useful e.g. for printing.
395
+ * The default value is `AnnotationMode.ENABLE`.
396
+ */
397
+ annotationMode?: number | undefined;
398
+ /**
399
+ * - Additional transform, applied just
400
+ * before viewport transform.
401
+ */
402
+ transform?: any[] | undefined;
403
+ /**
404
+ * - Background
405
+ * to use for the canvas.
406
+ * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
407
+ * <color> value, a `CanvasGradient` object (a linear or radial gradient) or
408
+ * a `CanvasPattern` object (a repetitive image). The default value is
409
+ * 'rgb(255,255,255)'.
410
+ *
411
+ * NOTE: This option may be partially, or completely, ignored when the
412
+ * `pageColors`-option is used.
413
+ */
414
+ background?: string | CanvasGradient | CanvasPattern | undefined;
415
+ /**
416
+ * - Overwrites background and foreground colors
417
+ * with user defined ones in order to improve readability in high contrast
418
+ * mode.
419
+ */
420
+ pageColors?: Object | undefined;
421
+ /**
422
+ * -
423
+ * A promise that should resolve with an {@link OptionalContentConfig }created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
424
+ * the configuration will be fetched automatically with the default visibility
425
+ * states set.
426
+ */
427
+ optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
428
+ /**
429
+ * - Map some
430
+ * annotation ids with canvases used to render them.
431
+ */
432
+ annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
433
+ printAnnotationStorage?: PrintAnnotationStorage | undefined;
434
+ };
435
+ /**
436
+ * Page render task parameters.
437
+ */
438
+ export type RenderTaskParameters = {
439
+ task: InternalRenderTask;
440
+ /**
441
+ * - Rendering intent, can be 'display', 'print',
442
+ * or 'any'. The default value is 'display'.
443
+ */
444
+ intent?: string | undefined;
445
+ /**
446
+ * Controls which annotations are rendered
447
+ * onto the canvas, for annotations with appearance-data; the values from
448
+ * {@link AnnotationMode } should be used. The following values are supported:
449
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
450
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
451
+ * it also depends on the `intent`-option, see above).
452
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
453
+ * interactive form elements (those will be rendered in the display layer).
454
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
455
+ * (as above) but where interactive form elements are updated with data
456
+ * from the {@link AnnotationStorage }-instance; useful e.g. for printing.
457
+ * The default value is `AnnotationMode.ENABLE`.
458
+ */
459
+ annotationMode?: number | undefined;
460
+ /**
461
+ * -
462
+ * A promise that should resolve with an {@link OptionalContentConfig }created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
463
+ * the configuration will be fetched automatically with the default visibility
464
+ * states set.
465
+ */
466
+ optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
467
+ printAnnotationStorage?: PrintAnnotationStorage | undefined;
468
+ };
469
+ /**
470
+ * Page getOperatorList parameters.
471
+ */
472
+ export type GetOperatorListParameters = {
473
+ /**
474
+ * - Rendering intent, can be 'display', 'print',
475
+ * or 'any'. The default value is 'display'.
476
+ */
477
+ intent?: string | undefined;
478
+ /**
479
+ * Controls which annotations are included
480
+ * in the operatorList, for annotations with appearance-data; the values from
481
+ * {@link AnnotationMode } should be used. The following values are supported:
482
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
483
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
484
+ * it also depends on the `intent`-option, see above).
485
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
486
+ * interactive form elements (those will be rendered in the display layer).
487
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
488
+ * (as above) but where interactive form elements are updated with data
489
+ * from the {@link AnnotationStorage }-instance; useful e.g. for printing.
490
+ * The default value is `AnnotationMode.ENABLE`.
491
+ */
492
+ annotationMode?: number | undefined;
493
+ printAnnotationStorage?: PrintAnnotationStorage | undefined;
494
+ };
495
+ /**
496
+ * Structure tree node. The root node will have a role "Root".
497
+ */
498
+ export type StructTreeNode = {
499
+ /**
500
+ * - Array of
501
+ * {@link StructTreeNode } and {@link StructTreeContent } objects.
502
+ */
503
+ children: Array<StructTreeNode | StructTreeContent>;
504
+ /**
505
+ * - element's role, already mapped if a role map exists
506
+ * in the PDF.
507
+ */
508
+ role: string;
509
+ };
510
+ /**
511
+ * Structure tree content.
512
+ */
513
+ export type StructTreeContent = {
514
+ /**
515
+ * - either "content" for page and stream structure
516
+ * elements or "object" for object references.
517
+ */
518
+ type: string;
519
+ /**
520
+ * - unique id that will map to the text layer.
521
+ */
522
+ id: string;
523
+ };
524
+ /**
525
+ * PDF page operator list.
526
+ */
527
+ export type PDFOperatorList = {
528
+ /**
529
+ * - Array containing the operator functions.
530
+ */
531
+ fnArray: Array<number>;
532
+ /**
533
+ * - Array containing the arguments of the
534
+ * functions.
535
+ */
536
+ argsArray: Array<any>;
537
+ };
538
+ export type PDFWorkerParameters = {
539
+ /**
540
+ * - The name of the worker.
541
+ */
542
+ name?: string | undefined;
543
+ /**
544
+ * - The `workerPort` object.
545
+ */
546
+ port?: Worker | undefined;
547
+ /**
548
+ * - Controls the logging level;
549
+ * the constants from {@link VerbosityLevel } should be used.
550
+ */
551
+ verbosity?: number | undefined;
552
+ };
553
+ /** @type {string} */
554
+ export const build: string;
555
+ export const DefaultCanvasFactory: any;
556
+ export const DefaultCMapReaderFactory: any;
557
+ export const DefaultFilterFactory: any;
558
+ export const DefaultStandardFontDataFactory: any;
559
+ /**
560
+ * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
561
+ * Int16Array | Uint16Array |
562
+ * Int32Array | Uint32Array | Float32Array |
563
+ * Float64Array
564
+ * } TypedArray
565
+ */
566
+ /**
567
+ * @typedef { TypedArray | ArrayBuffer | Array<number> | string } BinaryData
568
+ */
569
+ /**
570
+ * @typedef {Object} RefProxy
571
+ * @property {number} num
572
+ * @property {number} gen
573
+ */
574
+ /**
575
+ * Document initialization / loading parameters object.
576
+ *
577
+ * @typedef {Object} DocumentInitParameters
578
+ * @property {string | URL} [url] - The URL of the PDF.
579
+ * @property {BinaryData} [data] - Binary PDF data.
580
+ * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
581
+ * BASE64-encoded, use `atob()` to convert it to a binary string first.
582
+ *
583
+ * NOTE: If TypedArrays are used they will generally be transferred to the
584
+ * worker-thread. This will help reduce main-thread memory usage, however
585
+ * it will take ownership of the TypedArrays.
586
+ * @property {Object} [httpHeaders] - Basic authentication headers.
587
+ * @property {boolean} [withCredentials] - Indicates whether or not
588
+ * cross-site Access-Control requests should be made using credentials such
589
+ * as cookies or authorization headers. The default is `false`.
590
+ * @property {string} [password] - For decrypting password-protected PDFs.
591
+ * @property {number} [length] - The PDF file length. It's used for progress
592
+ * reports and range requests operations.
593
+ * @property {PDFDataRangeTransport} [range] - Allows for using a custom range
594
+ * transport implementation.
595
+ * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
596
+ * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
597
+ * @property {PDFWorker} [worker] - The worker that will be used for loading and
598
+ * parsing the PDF data.
599
+ * @property {number} [verbosity] - Controls the logging level; the constants
600
+ * from {@link VerbosityLevel} should be used.
601
+ * @property {string} [docBaseUrl] - The base URL of the document, used when
602
+ * attempting to recover valid absolute URLs for annotations, and outline
603
+ * items, that (incorrectly) only specify relative URLs.
604
+ * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are
605
+ * located. Include the trailing slash.
606
+ * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
607
+ * packed or not. The default value is `true`.
608
+ * @property {Object} [CMapReaderFactory] - The factory that will be used when
609
+ * reading built-in CMap files. Providing a custom factory is useful for
610
+ * environments without Fetch API or `XMLHttpRequest` support, such as
611
+ * Node.js. The default value is {DOMCMapReaderFactory}.
612
+ * @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
613
+ * embedded in the PDF document will fallback to a system font.
614
+ * The default value is `true` in web environments and `false` in Node.js;
615
+ * unless `disableFontFace === true` in which case this defaults to `false`
616
+ * regardless of the environment (to prevent completely broken fonts).
617
+ * @property {string} [standardFontDataUrl] - The URL where the standard font
618
+ * files are located. Include the trailing slash.
619
+ * @property {Object} [StandardFontDataFactory] - The factory that will be used
620
+ * when reading the standard font files. Providing a custom factory is useful
621
+ * for environments without Fetch API or `XMLHttpRequest` support, such as
622
+ * Node.js. The default value is {DOMStandardFontDataFactory}.
623
+ * @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the
624
+ * worker-thread when reading CMap and standard font files. When `true`,
625
+ * the `CMapReaderFactory` and `StandardFontDataFactory` options are ignored.
626
+ * The default value is `true` in web environments and `false` in Node.js.
627
+ * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
628
+ * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
629
+ * PDF data cannot be successfully parsed, instead of attempting to recover
630
+ * whatever possible of the data. The default value is `false`.
631
+ * @property {number} [maxImageSize] - The maximum allowed image size in total
632
+ * pixels, i.e. width * height. Images above this value will not be rendered.
633
+ * Use -1 for no limit, which is also the default value.
634
+ * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
635
+ * as JavaScript. Primarily used to improve performance of font rendering, and
636
+ * when parsing PDF functions. The default value is `true`.
637
+ * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use
638
+ * `OffscreenCanvas` in the worker. Primarily used to improve performance of
639
+ * image conversion/rendering.
640
+ * The default value is `true` in web environments and `false` in Node.js.
641
+ * @property {number} [canvasMaxAreaInBytes] - The integer value is used to
642
+ * know when an image must be resized (uses `OffscreenCanvas` in the worker).
643
+ * If it's -1 then a possibly slow algorithm is used to guess the max value.
644
+ * @property {boolean} [disableFontFace] - By default fonts are converted to
645
+ * OpenType fonts and loaded via the Font Loading API or `@font-face` rules.
646
+ * If disabled, fonts will be rendered using a built-in font renderer that
647
+ * constructs the glyphs with primitive path commands.
648
+ * The default value is `false` in web environments and `true` in Node.js.
649
+ * @property {boolean} [fontExtraProperties] - Include additional properties,
650
+ * which are unused during rendering of PDF documents, when exporting the
651
+ * parsed font data from the worker-thread. This may be useful for debugging
652
+ * purposes (and backwards compatibility), but note that it will lead to
653
+ * increased memory usage. The default value is `false`.
654
+ * @property {boolean} [enableXfa] - Render Xfa forms if any.
655
+ * The default value is `false`.
656
+ * @property {HTMLDocument} [ownerDocument] - Specify an explicit document
657
+ * context to create elements with and to load resources, such as fonts,
658
+ * into. Defaults to the current document.
659
+ * @property {boolean} [disableRange] - Disable range request loading of PDF
660
+ * files. When enabled, and if the server supports partial content requests,
661
+ * then the PDF will be fetched in chunks. The default value is `false`.
662
+ * @property {boolean} [disableStream] - Disable streaming of PDF file data.
663
+ * By default PDF.js attempts to load PDF files in chunks. The default value
664
+ * is `false`.
665
+ * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file
666
+ * data. When range requests are enabled PDF.js will automatically keep
667
+ * fetching more data even if it isn't needed to display the current page.
668
+ * The default value is `false`.
669
+ *
670
+ * NOTE: It is also necessary to disable streaming, see above, in order for
671
+ * disabling of pre-fetching to work correctly.
672
+ * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
673
+ * (see `web/debugger.js`). The default value is `false`.
674
+ * @property {Object} [canvasFactory] - The factory instance that will be used
675
+ * when creating canvases. The default value is {new DOMCanvasFactory()}.
676
+ * @property {Object} [filterFactory] - A factory instance that will be used
677
+ * to create SVG filters when rendering some images on the main canvas.
678
+ */
679
+ /**
680
+ * This is the main entry point for loading a PDF and interacting with it.
681
+ *
682
+ * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or
683
+ * XHR as fallback) is used, which means it must follow same origin rules,
684
+ * e.g. no cross-domain requests without CORS.
685
+ *
686
+ * @param {string | URL | TypedArray | ArrayBuffer | DocumentInitParameters}
687
+ * src - Can be a URL where a PDF file is located, a typed array (Uint8Array)
688
+ * already populated with data, or a parameter object.
689
+ * @returns {PDFDocumentLoadingTask}
690
+ */
691
+ export function getDocument(src: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
692
+ /**
693
+ * For internal use only.
694
+ * @ignore
695
+ */
696
+ export class InternalRenderTask {
697
+ static "__#39@#canvasInUse": WeakSet<object>;
698
+ constructor({ callback, params, objs, commonObjs, annotationCanvasMap, operatorList, pageIndex, canvasFactory, filterFactory, useRequestAnimationFrame, pdfBug, pageColors, }: {
699
+ callback: any;
700
+ params: any;
701
+ objs: any;
702
+ commonObjs: any;
703
+ annotationCanvasMap: any;
704
+ operatorList: any;
705
+ pageIndex: any;
706
+ canvasFactory: any;
707
+ filterFactory: any;
708
+ useRequestAnimationFrame?: boolean | undefined;
709
+ pdfBug?: boolean | undefined;
710
+ pageColors?: null | undefined;
711
+ });
712
+ callback: any;
713
+ params: any;
714
+ objs: any;
715
+ commonObjs: any;
716
+ annotationCanvasMap: any;
717
+ operatorListIdx: any;
718
+ operatorList: any;
719
+ _pageIndex: any;
720
+ canvasFactory: any;
721
+ filterFactory: any;
722
+ _pdfBug: boolean;
723
+ pageColors: any;
724
+ running: boolean;
725
+ graphicsReadyCallback: any;
726
+ graphicsReady: boolean;
727
+ _useRequestAnimationFrame: boolean;
728
+ cancelled: boolean;
729
+ capability: PromiseCapability;
730
+ task: RenderTask;
731
+ _cancelBound: (error?: null, extraDelay?: number) => void;
732
+ _continueBound: () => void;
733
+ _scheduleNextBound: () => void;
734
+ _nextBound: () => Promise<void>;
735
+ _canvas: any;
736
+ get completed(): Promise<any>;
737
+ initializeGraphics({ transparency, optionalContentConfig }: {
738
+ transparency?: boolean | undefined;
739
+ optionalContentConfig: any;
740
+ }): void;
741
+ stepper: any;
742
+ gfx: CanvasGraphics | undefined;
743
+ cancel(error?: null, extraDelay?: number): void;
744
+ operatorListChanged(): void;
745
+ _continue(): void;
746
+ _scheduleNext(): void;
747
+ _next(): Promise<void>;
748
+ }
749
+ export class LoopbackPort {
750
+ postMessage(obj: any, transfer: any): void;
751
+ addEventListener(name: any, listener: any): void;
752
+ removeEventListener(name: any, listener: any): void;
753
+ terminate(): void;
754
+ #private;
755
+ }
756
+ /**
757
+ * Abstract class to support range requests file loading.
758
+ *
759
+ * NOTE: The TypedArrays passed to the constructor and relevant methods below
760
+ * will generally be transferred to the worker-thread. This will help reduce
761
+ * main-thread memory usage, however it will take ownership of the TypedArrays.
762
+ */
763
+ export class PDFDataRangeTransport {
764
+ /**
765
+ * @param {number} length
766
+ * @param {Uint8Array|null} initialData
767
+ * @param {boolean} [progressiveDone]
768
+ * @param {string} [contentDispositionFilename]
769
+ */
770
+ constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean | undefined, contentDispositionFilename?: string | undefined);
771
+ length: number;
772
+ initialData: Uint8Array | null;
773
+ progressiveDone: boolean;
774
+ contentDispositionFilename: string;
775
+ _rangeListeners: any[];
776
+ _progressListeners: any[];
777
+ _progressiveReadListeners: any[];
778
+ _progressiveDoneListeners: any[];
779
+ _readyCapability: PromiseCapability;
780
+ /**
781
+ * @param {function} listener
782
+ */
783
+ addRangeListener(listener: Function): void;
784
+ /**
785
+ * @param {function} listener
786
+ */
787
+ addProgressListener(listener: Function): void;
788
+ /**
789
+ * @param {function} listener
790
+ */
791
+ addProgressiveReadListener(listener: Function): void;
792
+ /**
793
+ * @param {function} listener
794
+ */
795
+ addProgressiveDoneListener(listener: Function): void;
796
+ /**
797
+ * @param {number} begin
798
+ * @param {Uint8Array|null} chunk
799
+ */
800
+ onDataRange(begin: number, chunk: Uint8Array | null): void;
801
+ /**
802
+ * @param {number} loaded
803
+ * @param {number|undefined} total
804
+ */
805
+ onDataProgress(loaded: number, total: number | undefined): void;
806
+ /**
807
+ * @param {Uint8Array|null} chunk
808
+ */
809
+ onDataProgressiveRead(chunk: Uint8Array | null): void;
810
+ onDataProgressiveDone(): void;
811
+ transportReady(): void;
812
+ /**
813
+ * @param {number} begin
814
+ * @param {number} end
815
+ */
816
+ requestDataRange(begin: number, end: number): void;
817
+ abort(): void;
818
+ }
819
+ /**
820
+ * @typedef {Object} OnProgressParameters
821
+ * @property {number} loaded - Currently loaded number of bytes.
822
+ * @property {number} total - Total number of bytes in the PDF file.
823
+ */
824
+ /**
825
+ * The loading task controls the operations required to load a PDF document
826
+ * (such as network requests) and provides a way to listen for completion,
827
+ * after which individual pages can be rendered.
828
+ */
829
+ export class PDFDocumentLoadingTask {
830
+ static "__#32@#docId": number;
831
+ _capability: PromiseCapability;
832
+ _transport: any;
833
+ _worker: any;
834
+ /**
835
+ * Unique identifier for the document loading task.
836
+ * @type {string}
837
+ */
838
+ docId: string;
839
+ /**
840
+ * Whether the loading task is destroyed or not.
841
+ * @type {boolean}
842
+ */
843
+ destroyed: boolean;
844
+ /**
845
+ * Callback to request a password if a wrong or no password was provided.
846
+ * The callback receives two parameters: a function that should be called
847
+ * with the new password, and a reason (see {@link PasswordResponses}).
848
+ * @type {function}
849
+ */
850
+ onPassword: Function;
851
+ /**
852
+ * Callback to be able to monitor the loading progress of the PDF file
853
+ * (necessary to implement e.g. a loading bar).
854
+ * The callback receives an {@link OnProgressParameters} argument.
855
+ * @type {function}
856
+ */
857
+ onProgress: Function;
858
+ /**
859
+ * Promise for document loading task completion.
860
+ * @type {Promise<PDFDocumentProxy>}
861
+ */
862
+ get promise(): Promise<PDFDocumentProxy>;
863
+ /**
864
+ * Abort all network requests and destroy the worker.
865
+ * @returns {Promise<void>} A promise that is resolved when destruction is
866
+ * completed.
867
+ */
868
+ destroy(): Promise<void>;
869
+ }
870
+ /**
871
+ * Proxy to a `PDFDocument` in the worker thread.
872
+ */
873
+ export class PDFDocumentProxy {
874
+ constructor(pdfInfo: any, transport: any);
875
+ _pdfInfo: any;
876
+ _transport: any;
877
+ /**
878
+ * @type {AnnotationStorage} Storage for annotation data in forms.
879
+ */
880
+ get annotationStorage(): AnnotationStorage;
881
+ /**
882
+ * @type {Object} The filter factory instance.
883
+ */
884
+ get filterFactory(): Object;
885
+ /**
886
+ * @type {number} Total number of pages in the PDF file.
887
+ */
888
+ get numPages(): number;
889
+ /**
890
+ * @type {Array<string, string|null>} A (not guaranteed to be) unique ID to
891
+ * identify the PDF document.
892
+ * NOTE: The first element will always be defined for all PDF documents,
893
+ * whereas the second element is only defined for *modified* PDF documents.
894
+ */
895
+ get fingerprints(): string[];
896
+ /**
897
+ * @type {boolean} True if only XFA form.
898
+ */
899
+ get isPureXfa(): boolean;
900
+ /**
901
+ * NOTE: This is (mostly) intended to support printing of XFA forms.
902
+ *
903
+ * @type {Object | null} An object representing a HTML tree structure
904
+ * to render the XFA, or `null` when no XFA form exists.
905
+ */
906
+ get allXfaHtml(): Object | null;
907
+ /**
908
+ * @param {number} pageNumber - The page number to get. The first page is 1.
909
+ * @returns {Promise<PDFPageProxy>} A promise that is resolved with
910
+ * a {@link PDFPageProxy} object.
911
+ */
912
+ getPage(pageNumber: number): Promise<PDFPageProxy>;
913
+ /**
914
+ * @param {RefProxy} ref - The page reference.
915
+ * @returns {Promise<number>} A promise that is resolved with the page index,
916
+ * starting from zero, that is associated with the reference.
917
+ */
918
+ getPageIndex(ref: RefProxy): Promise<number>;
919
+ /**
920
+ * @returns {Promise<Object<string, Array<any>>>} A promise that is resolved
921
+ * with a mapping from named destinations to references.
922
+ *
923
+ * This can be slow for large documents. Use `getDestination` instead.
924
+ */
925
+ getDestinations(): Promise<{
926
+ [x: string]: Array<any>;
927
+ }>;
928
+ /**
929
+ * @param {string} id - The named destination to get.
930
+ * @returns {Promise<Array<any> | null>} A promise that is resolved with all
931
+ * information of the given named destination, or `null` when the named
932
+ * destination is not present in the PDF file.
933
+ */
934
+ getDestination(id: string): Promise<Array<any> | null>;
935
+ /**
936
+ * @returns {Promise<Array<string> | null>} A promise that is resolved with
937
+ * an {Array} containing the page labels that correspond to the page
938
+ * indexes, or `null` when no page labels are present in the PDF file.
939
+ */
940
+ getPageLabels(): Promise<Array<string> | null>;
941
+ /**
942
+ * @returns {Promise<string>} A promise that is resolved with a {string}
943
+ * containing the page layout name.
944
+ */
945
+ getPageLayout(): Promise<string>;
946
+ /**
947
+ * @returns {Promise<string>} A promise that is resolved with a {string}
948
+ * containing the page mode name.
949
+ */
950
+ getPageMode(): Promise<string>;
951
+ /**
952
+ * @returns {Promise<Object | null>} A promise that is resolved with an
953
+ * {Object} containing the viewer preferences, or `null` when no viewer
954
+ * preferences are present in the PDF file.
955
+ */
956
+ getViewerPreferences(): Promise<Object | null>;
957
+ /**
958
+ * @returns {Promise<any | null>} A promise that is resolved with an {Array}
959
+ * containing the destination, or `null` when no open action is present
960
+ * in the PDF.
961
+ */
962
+ getOpenAction(): Promise<any | null>;
963
+ /**
964
+ * @returns {Promise<any>} A promise that is resolved with a lookup table
965
+ * for mapping named attachments to their content.
966
+ */
967
+ getAttachments(): Promise<any>;
968
+ /**
969
+ * @returns {Promise<Object | null>} A promise that is resolved with
970
+ * an {Object} with the JavaScript actions:
971
+ * - from the name tree.
972
+ * - from A or AA entries in the catalog dictionary.
973
+ * , or `null` if no JavaScript exists.
974
+ */
975
+ getJSActions(): Promise<Object | null>;
976
+ /**
977
+ * @typedef {Object} OutlineNode
978
+ * @property {string} title
979
+ * @property {boolean} bold
980
+ * @property {boolean} italic
981
+ * @property {Uint8ClampedArray} color - The color in RGB format to use for
982
+ * display purposes.
983
+ * @property {string | Array<any> | null} dest
984
+ * @property {string | null} url
985
+ * @property {string | undefined} unsafeUrl
986
+ * @property {boolean | undefined} newWindow
987
+ * @property {number | undefined} count
988
+ * @property {Array<OutlineNode>} items
989
+ */
990
+ /**
991
+ * @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an
992
+ * {Array} that is a tree outline (if it has one) of the PDF file.
993
+ */
994
+ getOutline(): Promise<{
995
+ title: string;
996
+ bold: boolean;
997
+ italic: boolean;
998
+ /**
999
+ * - The color in RGB format to use for
1000
+ * display purposes.
1001
+ */
1002
+ color: Uint8ClampedArray;
1003
+ dest: string | Array<any> | null;
1004
+ url: string | null;
1005
+ unsafeUrl: string | undefined;
1006
+ newWindow: boolean | undefined;
1007
+ count: number | undefined;
1008
+ items: any[];
1009
+ }[]>;
1010
+ /**
1011
+ * @returns {Promise<OptionalContentConfig>} A promise that is resolved with
1012
+ * an {@link OptionalContentConfig} that contains all the optional content
1013
+ * groups (assuming that the document has any).
1014
+ */
1015
+ getOptionalContentConfig(): Promise<OptionalContentConfig>;
1016
+ /**
1017
+ * @returns {Promise<Array<number> | null>} A promise that is resolved with
1018
+ * an {Array} that contains the permission flags for the PDF document, or
1019
+ * `null` when no permissions are present in the PDF file.
1020
+ */
1021
+ getPermissions(): Promise<Array<number> | null>;
1022
+ /**
1023
+ * @returns {Promise<{ info: Object, metadata: Metadata }>} A promise that is
1024
+ * resolved with an {Object} that has `info` and `metadata` properties.
1025
+ * `info` is an {Object} filled with anything available in the information
1026
+ * dictionary and similarly `metadata` is a {Metadata} object with
1027
+ * information from the metadata section of the PDF.
1028
+ */
1029
+ getMetadata(): Promise<{
1030
+ info: Object;
1031
+ metadata: Metadata;
1032
+ }>;
1033
+ /**
1034
+ * @typedef {Object} MarkInfo
1035
+ * Properties correspond to Table 321 of the PDF 32000-1:2008 spec.
1036
+ * @property {boolean} Marked
1037
+ * @property {boolean} UserProperties
1038
+ * @property {boolean} Suspects
1039
+ */
1040
+ /**
1041
+ * @returns {Promise<MarkInfo | null>} A promise that is resolved with
1042
+ * a {MarkInfo} object that contains the MarkInfo flags for the PDF
1043
+ * document, or `null` when no MarkInfo values are present in the PDF file.
1044
+ */
1045
+ getMarkInfo(): Promise<{
1046
+ Marked: boolean;
1047
+ UserProperties: boolean;
1048
+ Suspects: boolean;
1049
+ } | null>;
1050
+ /**
1051
+ * @returns {Promise<Uint8Array>} A promise that is resolved with a
1052
+ * {Uint8Array} containing the raw data of the PDF document.
1053
+ */
1054
+ getData(): Promise<Uint8Array>;
1055
+ /**
1056
+ * @returns {Promise<Uint8Array>} A promise that is resolved with a
1057
+ * {Uint8Array} containing the full data of the saved document.
1058
+ */
1059
+ saveDocument(): Promise<Uint8Array>;
1060
+ /**
1061
+ * @returns {Promise<{ length: number }>} A promise that is resolved when the
1062
+ * document's data is loaded. It is resolved with an {Object} that contains
1063
+ * the `length` property that indicates size of the PDF data in bytes.
1064
+ */
1065
+ getDownloadInfo(): Promise<{
1066
+ length: number;
1067
+ }>;
1068
+ /**
1069
+ * Cleans up resources allocated by the document on both the main and worker
1070
+ * threads.
1071
+ *
1072
+ * NOTE: Do not, under any circumstances, call this method when rendering is
1073
+ * currently ongoing since that may lead to rendering errors.
1074
+ *
1075
+ * @param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM.
1076
+ * NOTE: This will increase persistent memory usage, hence don't use this
1077
+ * option unless absolutely necessary. The default value is `false`.
1078
+ * @returns {Promise} A promise that is resolved when clean-up has finished.
1079
+ */
1080
+ cleanup(keepLoadedFonts?: boolean | undefined): Promise<any>;
1081
+ /**
1082
+ * Destroys the current document instance and terminates the worker.
1083
+ */
1084
+ destroy(): Promise<void>;
1085
+ /**
1086
+ * @type {DocumentInitParameters} A subset of the current
1087
+ * {DocumentInitParameters}, which are needed in the viewer.
1088
+ */
1089
+ get loadingParams(): DocumentInitParameters;
1090
+ /**
1091
+ * @type {PDFDocumentLoadingTask} The loadingTask for the current document.
1092
+ */
1093
+ get loadingTask(): PDFDocumentLoadingTask;
1094
+ /**
1095
+ * @returns {Promise<Object<string, Array<Object>> | null>} A promise that is
1096
+ * resolved with an {Object} containing /AcroForm field data for the JS
1097
+ * sandbox, or `null` when no field data is present in the PDF file.
1098
+ */
1099
+ getFieldObjects(): Promise<{
1100
+ [x: string]: Array<Object>;
1101
+ } | null>;
1102
+ /**
1103
+ * @returns {Promise<boolean>} A promise that is resolved with `true`
1104
+ * if some /AcroForm fields have JavaScript actions.
1105
+ */
1106
+ hasJSActions(): Promise<boolean>;
1107
+ /**
1108
+ * @returns {Promise<Array<string> | null>} A promise that is resolved with an
1109
+ * {Array<string>} containing IDs of annotations that have a calculation
1110
+ * action, or `null` when no such annotations are present in the PDF file.
1111
+ */
1112
+ getCalculationOrderIds(): Promise<Array<string> | null>;
1113
+ }
1114
+ /**
1115
+ * Page getViewport parameters.
1116
+ *
1117
+ * @typedef {Object} GetViewportParameters
1118
+ * @property {number} scale - The desired scale of the viewport.
1119
+ * @property {number} [rotation] - The desired rotation, in degrees, of
1120
+ * the viewport. If omitted it defaults to the page rotation.
1121
+ * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.
1122
+ * The default value is `0`.
1123
+ * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.
1124
+ * The default value is `0`.
1125
+ * @property {boolean} [dontFlip] - If true, the y-axis will not be
1126
+ * flipped. The default value is `false`.
1127
+ */
1128
+ /**
1129
+ * Page getTextContent parameters.
1130
+ *
1131
+ * @typedef {Object} getTextContentParameters
1132
+ * @property {boolean} [includeMarkedContent] - When true include marked
1133
+ * content items in the items array of TextContent. The default is `false`.
1134
+ * @property {boolean} [disableNormalization] - When true the text is *not*
1135
+ * normalized in the worker-thread. The default is `false`.
1136
+ */
1137
+ /**
1138
+ * Page text content.
1139
+ *
1140
+ * @typedef {Object} TextContent
1141
+ * @property {Array<TextItem | TextMarkedContent>} items - Array of
1142
+ * {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent
1143
+ * items are included when includeMarkedContent is true.
1144
+ * @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
1145
+ * indexed by font name.
1146
+ */
1147
+ /**
1148
+ * Page text content part.
1149
+ *
1150
+ * @typedef {Object} TextItem
1151
+ * @property {string} str - Text content.
1152
+ * @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'.
1153
+ * @property {Array<any>} transform - Transformation matrix.
1154
+ * @property {number} width - Width in device space.
1155
+ * @property {number} height - Height in device space.
1156
+ * @property {string} fontName - Font name used by PDF.js for converted font.
1157
+ * @property {boolean} hasEOL - Indicating if the text content is followed by a
1158
+ * line-break.
1159
+ */
1160
+ /**
1161
+ * Page text marked content part.
1162
+ *
1163
+ * @typedef {Object} TextMarkedContent
1164
+ * @property {string} type - Either 'beginMarkedContent',
1165
+ * 'beginMarkedContentProps', or 'endMarkedContent'.
1166
+ * @property {string} id - The marked content identifier. Only used for type
1167
+ * 'beginMarkedContentProps'.
1168
+ */
1169
+ /**
1170
+ * Text style.
1171
+ *
1172
+ * @typedef {Object} TextStyle
1173
+ * @property {number} ascent - Font ascent.
1174
+ * @property {number} descent - Font descent.
1175
+ * @property {boolean} vertical - Whether or not the text is in vertical mode.
1176
+ * @property {string} fontFamily - The possible font family.
1177
+ */
1178
+ /**
1179
+ * Page annotation parameters.
1180
+ *
1181
+ * @typedef {Object} GetAnnotationsParameters
1182
+ * @property {string} [intent] - Determines the annotations that are fetched,
1183
+ * can be 'display' (viewable annotations), 'print' (printable annotations),
1184
+ * or 'any' (all annotations). The default value is 'display'.
1185
+ */
1186
+ /**
1187
+ * Page render parameters.
1188
+ *
1189
+ * @typedef {Object} RenderParameters
1190
+ * @property {CanvasRenderingContext2D} canvasContext - A 2D context of a DOM
1191
+ * Canvas object.
1192
+ * @property {PageViewport} viewport - Rendering viewport obtained by calling
1193
+ * the `PDFPageProxy.getViewport` method.
1194
+ * @property {string} [intent] - Rendering intent, can be 'display', 'print',
1195
+ * or 'any'. The default value is 'display'.
1196
+ * @property {number} [annotationMode] Controls which annotations are rendered
1197
+ * onto the canvas, for annotations with appearance-data; the values from
1198
+ * {@link AnnotationMode} should be used. The following values are supported:
1199
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
1200
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
1201
+ * it also depends on the `intent`-option, see above).
1202
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
1203
+ * interactive form elements (those will be rendered in the display layer).
1204
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
1205
+ * (as above) but where interactive form elements are updated with data
1206
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
1207
+ * The default value is `AnnotationMode.ENABLE`.
1208
+ * @property {Array<any>} [transform] - Additional transform, applied just
1209
+ * before viewport transform.
1210
+ * @property {CanvasGradient | CanvasPattern | string} [background] - Background
1211
+ * to use for the canvas.
1212
+ * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
1213
+ * <color> value, a `CanvasGradient` object (a linear or radial gradient) or
1214
+ * a `CanvasPattern` object (a repetitive image). The default value is
1215
+ * 'rgb(255,255,255)'.
1216
+ *
1217
+ * NOTE: This option may be partially, or completely, ignored when the
1218
+ * `pageColors`-option is used.
1219
+ * @property {Object} [pageColors] - Overwrites background and foreground colors
1220
+ * with user defined ones in order to improve readability in high contrast
1221
+ * mode.
1222
+ * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
1223
+ * A promise that should resolve with an {@link OptionalContentConfig}
1224
+ * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
1225
+ * the configuration will be fetched automatically with the default visibility
1226
+ * states set.
1227
+ * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
1228
+ * annotation ids with canvases used to render them.
1229
+ * @property {PrintAnnotationStorage} [printAnnotationStorage]
1230
+ */
1231
+ /**
1232
+ * Page render task parameters.
1233
+ *
1234
+ * @typedef {Object} RenderTaskParameters
1235
+ * @property {InternalRenderTask} task
1236
+ * @property {string} [intent] - Rendering intent, can be 'display', 'print',
1237
+ * or 'any'. The default value is 'display'.
1238
+ * @property {number} [annotationMode] Controls which annotations are rendered
1239
+ * onto the canvas, for annotations with appearance-data; the values from
1240
+ * {@link AnnotationMode} should be used. The following values are supported:
1241
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
1242
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
1243
+ * it also depends on the `intent`-option, see above).
1244
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
1245
+ * interactive form elements (those will be rendered in the display layer).
1246
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
1247
+ * (as above) but where interactive form elements are updated with data
1248
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
1249
+ * The default value is `AnnotationMode.ENABLE`.
1250
+ * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
1251
+ * A promise that should resolve with an {@link OptionalContentConfig}
1252
+ * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
1253
+ * the configuration will be fetched automatically with the default visibility
1254
+ * states set.
1255
+ * @property {PrintAnnotationStorage} [printAnnotationStorage]
1256
+ */
1257
+ /**
1258
+ * Page getOperatorList parameters.
1259
+ *
1260
+ * @typedef {Object} GetOperatorListParameters
1261
+ * @property {string} [intent] - Rendering intent, can be 'display', 'print',
1262
+ * or 'any'. The default value is 'display'.
1263
+ * @property {number} [annotationMode] Controls which annotations are included
1264
+ * in the operatorList, for annotations with appearance-data; the values from
1265
+ * {@link AnnotationMode} should be used. The following values are supported:
1266
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
1267
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
1268
+ * it also depends on the `intent`-option, see above).
1269
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
1270
+ * interactive form elements (those will be rendered in the display layer).
1271
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
1272
+ * (as above) but where interactive form elements are updated with data
1273
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
1274
+ * The default value is `AnnotationMode.ENABLE`.
1275
+ * @property {PrintAnnotationStorage} [printAnnotationStorage]
1276
+ */
1277
+ /**
1278
+ * Structure tree node. The root node will have a role "Root".
1279
+ *
1280
+ * @typedef {Object} StructTreeNode
1281
+ * @property {Array<StructTreeNode | StructTreeContent>} children - Array of
1282
+ * {@link StructTreeNode} and {@link StructTreeContent} objects.
1283
+ * @property {string} role - element's role, already mapped if a role map exists
1284
+ * in the PDF.
1285
+ */
1286
+ /**
1287
+ * Structure tree content.
1288
+ *
1289
+ * @typedef {Object} StructTreeContent
1290
+ * @property {string} type - either "content" for page and stream structure
1291
+ * elements or "object" for object references.
1292
+ * @property {string} id - unique id that will map to the text layer.
1293
+ */
1294
+ /**
1295
+ * PDF page operator list.
1296
+ *
1297
+ * @typedef {Object} PDFOperatorList
1298
+ * @property {Array<number>} fnArray - Array containing the operator functions.
1299
+ * @property {Array<any>} argsArray - Array containing the arguments of the
1300
+ * functions.
1301
+ */
1302
+ /**
1303
+ * Proxy to a `PDFPage` in the worker thread.
1304
+ */
1305
+ export class PDFPageProxy {
1306
+ constructor(pageIndex: any, pageInfo: any, transport: any, pdfBug?: boolean);
1307
+ _pageIndex: any;
1308
+ _pageInfo: any;
1309
+ _transport: any;
1310
+ _stats: StatTimer | null;
1311
+ _pdfBug: boolean;
1312
+ /** @type {PDFObjects} */
1313
+ commonObjs: PDFObjects;
1314
+ objs: PDFObjects;
1315
+ _maybeCleanupAfterRender: boolean;
1316
+ _intentStates: Map<any, any>;
1317
+ destroyed: boolean;
1318
+ /**
1319
+ * @type {number} Page number of the page. First page is 1.
1320
+ */
1321
+ get pageNumber(): number;
1322
+ /**
1323
+ * @type {number} The number of degrees the page is rotated clockwise.
1324
+ */
1325
+ get rotate(): number;
1326
+ /**
1327
+ * @type {RefProxy | null} The reference that points to this page.
1328
+ */
1329
+ get ref(): RefProxy | null;
1330
+ /**
1331
+ * @type {number} The default size of units in 1/72nds of an inch.
1332
+ */
1333
+ get userUnit(): number;
1334
+ /**
1335
+ * @type {Array<number>} An array of the visible portion of the PDF page in
1336
+ * user space units [x1, y1, x2, y2].
1337
+ */
1338
+ get view(): number[];
1339
+ /**
1340
+ * @param {GetViewportParameters} params - Viewport parameters.
1341
+ * @returns {PageViewport} Contains 'width' and 'height' properties
1342
+ * along with transforms required for rendering.
1343
+ */
1344
+ getViewport({ scale, rotation, offsetX, offsetY, dontFlip, }?: GetViewportParameters): PageViewport;
1345
+ /**
1346
+ * @param {GetAnnotationsParameters} params - Annotation parameters.
1347
+ * @returns {Promise<Array<any>>} A promise that is resolved with an
1348
+ * {Array} of the annotation objects.
1349
+ */
1350
+ getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
1351
+ /**
1352
+ * @returns {Promise<Object>} A promise that is resolved with an
1353
+ * {Object} with JS actions.
1354
+ */
1355
+ getJSActions(): Promise<Object>;
1356
+ /**
1357
+ * @type {Object} The filter factory instance.
1358
+ */
1359
+ get filterFactory(): Object;
1360
+ /**
1361
+ * @type {boolean} True if only XFA form.
1362
+ */
1363
+ get isPureXfa(): boolean;
1364
+ /**
1365
+ * @returns {Promise<Object | null>} A promise that is resolved with
1366
+ * an {Object} with a fake DOM object (a tree structure where elements
1367
+ * are {Object} with a name, attributes (class, style, ...), value and
1368
+ * children, very similar to a HTML DOM tree), or `null` if no XFA exists.
1369
+ */
1370
+ getXfa(): Promise<Object | null>;
1371
+ /**
1372
+ * Begins the process of rendering a page to the desired context.
1373
+ *
1374
+ * @param {RenderParameters} params - Page render parameters.
1375
+ * @returns {RenderTask} An object that contains a promise that is
1376
+ * resolved when the page finishes rendering.
1377
+ */
1378
+ render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, }: RenderParameters): RenderTask;
1379
+ /**
1380
+ * Begins the process of rendering a page to the desired context.
1381
+ *
1382
+ * @param {RenderTaskParameters} params - Page render parameters.
1383
+ * @returns {RenderTask} An object that contains a promise that is
1384
+ * resolved when the page finishes rendering.
1385
+ */
1386
+ renderTask({ task: renderTask, intent, annotationMode, optionalContentConfigPromise, printAnnotationStorage, }: RenderTaskParameters): RenderTask;
1387
+ /**
1388
+ * @param {GetOperatorListParameters} params - Page getOperatorList
1389
+ * parameters.
1390
+ * @returns {Promise<PDFOperatorList>} A promise resolved with an
1391
+ * {@link PDFOperatorList} object that represents the page's operator list.
1392
+ */
1393
+ getOperatorList({ intent, annotationMode, printAnnotationStorage, }?: GetOperatorListParameters): Promise<PDFOperatorList>;
1394
+ /**
1395
+ * NOTE: All occurrences of whitespace will be replaced by
1396
+ * standard spaces (0x20).
1397
+ *
1398
+ * @param {getTextContentParameters} params - getTextContent parameters.
1399
+ * @returns {ReadableStream} Stream for reading text content chunks.
1400
+ */
1401
+ streamTextContent({ includeMarkedContent, disableNormalization, }?: getTextContentParameters): ReadableStream;
1402
+ /**
1403
+ * NOTE: All occurrences of whitespace will be replaced by
1404
+ * standard spaces (0x20).
1405
+ *
1406
+ * @param {getTextContentParameters} params - getTextContent parameters.
1407
+ * @returns {Promise<TextContent>} A promise that is resolved with a
1408
+ * {@link TextContent} object that represents the page's text content.
1409
+ */
1410
+ getTextContent(params?: getTextContentParameters): Promise<TextContent>;
1411
+ /**
1412
+ * @returns {Promise<StructTreeNode>} A promise that is resolved with a
1413
+ * {@link StructTreeNode} object that represents the page's structure tree,
1414
+ * or `null` when no structure tree is present for the current page.
1415
+ */
1416
+ getStructTree(): Promise<StructTreeNode>;
1417
+ /**
1418
+ * Destroys the page object.
1419
+ * @private
1420
+ */
1421
+ private _destroy;
1422
+ /**
1423
+ * Cleans up resources allocated by the page.
1424
+ *
1425
+ * @param {boolean} [resetStats] - Reset page stats, if enabled.
1426
+ * The default value is `false`.
1427
+ * @returns {boolean} Indicates if clean-up was successfully run.
1428
+ */
1429
+ cleanup(resetStats?: boolean | undefined): boolean;
1430
+ /**
1431
+ * @private
1432
+ */
1433
+ private _startRenderPage;
1434
+ /**
1435
+ * @private
1436
+ */
1437
+ private _renderPageChunk;
1438
+ /**
1439
+ * @private
1440
+ */
1441
+ private _pumpOperatorList;
1442
+ /**
1443
+ * @private
1444
+ */
1445
+ private _abortOperatorList;
1446
+ /**
1447
+ * @type {StatTimer | null} Returns page stats, if enabled; returns `null`
1448
+ * otherwise.
1449
+ */
1450
+ get stats(): StatTimer | null;
1451
+ #private;
1452
+ }
1453
+ /**
1454
+ * PDF.js web worker abstraction that controls the instantiation of PDF
1455
+ * documents. Message handlers are used to pass information from the main
1456
+ * thread to the worker thread and vice versa. If the creation of a web
1457
+ * worker is not possible, a "fake" worker will be used instead.
1458
+ *
1459
+ * @param {PDFWorkerParameters} params - The worker initialization parameters.
1460
+ */
1461
+ export class PDFWorker {
1462
+ static "__#35@#workerPorts": any;
1463
+ /**
1464
+ * @param {PDFWorkerParameters} params - The worker initialization parameters.
1465
+ */
1466
+ static fromPort(params: PDFWorkerParameters): any;
1467
+ /**
1468
+ * The current `workerSrc`, when it exists.
1469
+ * @type {string}
1470
+ */
1471
+ static get workerSrc(): string;
1472
+ static get _mainThreadWorkerMessageHandler(): any;
1473
+ static get _setupFakeWorkerGlobal(): any;
1474
+ constructor({ name, port, verbosity, }?: {
1475
+ name?: null | undefined;
1476
+ port?: null | undefined;
1477
+ verbosity?: number | undefined;
1478
+ });
1479
+ name: any;
1480
+ destroyed: boolean;
1481
+ verbosity: number;
1482
+ _readyCapability: PromiseCapability;
1483
+ _port: any;
1484
+ _webWorker: Worker | null;
1485
+ _messageHandler: MessageHandler | null;
1486
+ /**
1487
+ * Promise for worker initialization completion.
1488
+ * @type {Promise<void>}
1489
+ */
1490
+ get promise(): Promise<void>;
1491
+ /**
1492
+ * The current `workerPort`, when it exists.
1493
+ * @type {Worker}
1494
+ */
1495
+ get port(): Worker;
1496
+ /**
1497
+ * The current MessageHandler-instance.
1498
+ * @type {MessageHandler}
1499
+ */
1500
+ get messageHandler(): MessageHandler;
1501
+ _initializeFromPort(port: any): void;
1502
+ _initialize(): void;
1503
+ _setupFakeWorker(): void;
1504
+ /**
1505
+ * Destroys the worker instance.
1506
+ */
1507
+ destroy(): void;
1508
+ }
1509
+ export namespace PDFWorkerUtil {
1510
+ let isWorkerDisabled: boolean;
1511
+ let fallbackWorkerSrc: null;
1512
+ let fakeWorkerId: number;
1513
+ }
1514
+ /**
1515
+ * Allows controlling of the rendering tasks.
1516
+ */
1517
+ export class RenderTask {
1518
+ constructor(internalRenderTask: any);
1519
+ /**
1520
+ * Callback for incremental rendering -- a function that will be called
1521
+ * each time the rendering is paused. To continue rendering call the
1522
+ * function that is the first argument to the callback.
1523
+ * @type {function}
1524
+ */
1525
+ onContinue: Function;
1526
+ /**
1527
+ * Promise for rendering task completion.
1528
+ * @type {Promise<void>}
1529
+ */
1530
+ get promise(): Promise<void>;
1531
+ /**
1532
+ * Cancels the rendering task. If the task is currently rendering it will
1533
+ * not be cancelled until graphics pauses with a timeout. The promise that
1534
+ * this object extends will be rejected when cancelled.
1535
+ *
1536
+ * @param {number} [extraDelay]
1537
+ */
1538
+ cancel(extraDelay?: number | undefined): void;
1539
+ /**
1540
+ * Whether form fields are rendered separately from the main operatorList.
1541
+ * @type {boolean}
1542
+ */
1543
+ get separateAnnots(): boolean;
1544
+ #private;
1545
+ }
1546
+ /** @type {string} */
1547
+ export const version: string;
1548
+ import { PageViewport } from "./display_utils.js";
1549
+ import { OptionalContentConfig } from "./optional_content_config.js";
1550
+ import { PrintAnnotationStorage } from "./annotation_storage.js";
1551
+ import { PromiseCapability } from "../shared/util.js";
1552
+ import { CanvasGraphics } from "./canvas.js";
1553
+ import { AnnotationStorage } from "./annotation_storage.js";
1554
+ import { info } from "../shared/util.js";
1555
+ import { Metadata } from "./metadata.js";
1556
+ import { StatTimer } from "./display_utils.js";
1557
+ /**
1558
+ * A PDF document and page is built of many objects. E.g. there are objects for
1559
+ * fonts, images, rendering code, etc. These objects may get processed inside of
1560
+ * a worker. This class implements some basic methods to manage these objects.
1561
+ */
1562
+ declare class PDFObjects {
1563
+ /**
1564
+ * If called *without* callback, this returns the data of `objId` but the
1565
+ * object needs to be resolved. If it isn't, this method throws.
1566
+ *
1567
+ * If called *with* a callback, the callback is called with the data of the
1568
+ * object once the object is resolved. That means, if you call this method
1569
+ * and the object is already resolved, the callback gets called right away.
1570
+ *
1571
+ * @param {string} objId
1572
+ * @param {function} [callback]
1573
+ * @returns {any}
1574
+ */
1575
+ get(objId: string, callback?: Function | undefined): any;
1576
+ /**
1577
+ * @param {string} objId
1578
+ * @returns {boolean}
1579
+ */
1580
+ has(objId: string): boolean;
1581
+ /**
1582
+ * Resolves the object `objId` with optional `data`.
1583
+ *
1584
+ * @param {string} objId
1585
+ * @param {any} [data]
1586
+ */
1587
+ resolve(objId: string, data?: any): void;
1588
+ clear(): void;
1589
+ #private;
1590
+ }
1591
+ import { MessageHandler } from "../shared/message_handler.js";
1592
+ export { SVGGraphics };