@pdfme/pdf-lib 6.0.3 → 6.0.5-dev.1

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 (449) hide show
  1. package/{src/api/Embeddable.ts → dist/api/Embeddable.d.ts} +1 -1
  2. package/dist/api/PDFDocument.d.ts +778 -0
  3. package/dist/api/PDFDocumentOptions.d.ts +38 -0
  4. package/dist/api/PDFEmbeddedFile.d.ts +38 -0
  5. package/dist/api/PDFEmbeddedPage.d.ts +73 -0
  6. package/dist/api/PDFFont.d.ts +94 -0
  7. package/dist/api/PDFImage.d.ts +95 -0
  8. package/dist/api/PDFJavaScript.d.ts +38 -0
  9. package/dist/api/PDFPage.d.ts +910 -0
  10. package/dist/api/PDFPageOptions.d.ts +172 -0
  11. package/dist/api/StandardFonts.d.ts +16 -0
  12. package/dist/api/colors.d.ts +34 -0
  13. package/dist/api/errors.d.ts +42 -0
  14. package/dist/api/form/PDFButton.d.ts +137 -0
  15. package/dist/api/form/PDFCheckBox.d.ts +142 -0
  16. package/dist/api/form/PDFDropdown.d.ts +402 -0
  17. package/dist/api/form/PDFField.d.ts +203 -0
  18. package/dist/api/form/PDFForm.d.ts +411 -0
  19. package/dist/api/form/PDFOptionList.d.ts +335 -0
  20. package/dist/api/form/PDFRadioGroup.d.ts +252 -0
  21. package/dist/api/form/PDFSignature.d.ts +29 -0
  22. package/dist/api/form/PDFTextField.d.ts +537 -0
  23. package/dist/api/form/appearances.d.ts +41 -0
  24. package/dist/api/image/alignment.d.ts +5 -0
  25. package/dist/api/objects.d.ts +4 -0
  26. package/dist/api/operations.d.ts +226 -0
  27. package/dist/api/operators.d.ts +90 -0
  28. package/dist/api/rotations.d.ts +38 -0
  29. package/dist/api/sizes.d.ts +52 -0
  30. package/dist/api/svg.d.ts +70 -0
  31. package/dist/api/svgPath.d.ts +2 -0
  32. package/dist/api/text/alignment.d.ts +5 -0
  33. package/dist/api/text/layout.d.ts +54 -0
  34. package/dist/core/PDFContext.d.ts +84 -0
  35. package/dist/core/PDFObjectCopier.d.ts +37 -0
  36. package/dist/core/acroform/PDFAcroButton.d.ts +21 -0
  37. package/dist/core/acroform/PDFAcroCheckBox.d.ts +13 -0
  38. package/dist/core/acroform/PDFAcroChoice.d.ts +20 -0
  39. package/dist/core/acroform/PDFAcroComboBox.d.ts +9 -0
  40. package/dist/core/acroform/PDFAcroField.d.ts +36 -0
  41. package/dist/core/acroform/PDFAcroForm.d.ts +20 -0
  42. package/dist/core/acroform/PDFAcroListBox.d.ts +9 -0
  43. package/dist/core/acroform/PDFAcroNonTerminal.d.ts +13 -0
  44. package/dist/core/acroform/PDFAcroPushButton.d.ts +9 -0
  45. package/dist/core/acroform/PDFAcroRadioButton.d.ts +13 -0
  46. package/{src/core/acroform/PDFAcroSignature.ts → dist/core/acroform/PDFAcroSignature.d.ts} +2 -4
  47. package/dist/core/acroform/PDFAcroTerminal.d.ts +16 -0
  48. package/dist/core/acroform/PDFAcroText.d.ts +22 -0
  49. package/dist/core/acroform/flags.d.ts +141 -0
  50. package/dist/core/acroform/utils.d.ts +6 -0
  51. package/dist/core/annotation/AppearanceCharacteristics.d.ts +33 -0
  52. package/dist/core/annotation/BorderStyle.d.ts +11 -0
  53. package/dist/core/annotation/PDFAnnotation.d.ts +51 -0
  54. package/dist/core/annotation/PDFWidgetAnnotation.d.ts +26 -0
  55. package/dist/core/annotation/flags.d.ts +79 -0
  56. package/dist/core/crypto.d.ts +95 -0
  57. package/dist/core/document/PDFCrossRefSection.d.ts +27 -0
  58. package/dist/core/document/PDFHeader.d.ts +10 -0
  59. package/dist/core/document/PDFTrailer.d.ts +9 -0
  60. package/dist/core/document/PDFTrailerDict.d.ts +10 -0
  61. package/dist/core/embedders/CMap.d.ts +3 -0
  62. package/dist/core/embedders/CustomFontEmbedder.d.ts +44 -0
  63. package/dist/core/embedders/CustomFontSubsetEmbedder.d.ts +20 -0
  64. package/dist/core/embedders/FileEmbedder.d.ts +33 -0
  65. package/dist/core/embedders/FontFlags.d.ts +13 -0
  66. package/dist/core/embedders/JavaScriptEmbedder.d.ts +10 -0
  67. package/dist/core/embedders/JpegEmbedder.d.ts +23 -0
  68. package/dist/core/embedders/PDFPageEmbedder.d.ts +37 -0
  69. package/dist/core/embedders/PngEmbedder.d.ts +19 -0
  70. package/dist/core/embedders/StandardFontEmbedder.d.ts +36 -0
  71. package/dist/core/errors.d.ts +94 -0
  72. package/{src/core/index.ts → dist/core/index.d.ts} +1 -17
  73. package/dist/core/interactive/ViewerPreferences.d.ts +347 -0
  74. package/dist/core/objects/PDFArray.d.ts +63 -0
  75. package/dist/core/objects/PDFBool.d.ts +13 -0
  76. package/dist/core/objects/PDFDict.d.ts +62 -0
  77. package/dist/core/objects/PDFHexString.d.ts +16 -0
  78. package/dist/core/objects/PDFInvalidObject.d.ts +11 -0
  79. package/dist/core/objects/PDFName.d.ts +41 -0
  80. package/dist/core/objects/PDFNull.d.ts +10 -0
  81. package/dist/core/objects/PDFNumber.d.ts +15 -0
  82. package/dist/core/objects/PDFObject.d.ts +8 -0
  83. package/dist/core/objects/PDFRawStream.d.ts +16 -0
  84. package/dist/core/objects/PDFRef.d.ts +13 -0
  85. package/dist/core/objects/PDFStream.d.ts +16 -0
  86. package/dist/core/objects/PDFString.d.ts +16 -0
  87. package/dist/core/operators/PDFOperator.d.ts +19 -0
  88. package/dist/core/operators/PDFOperatorNames.d.ts +76 -0
  89. package/dist/core/parser/BaseParser.d.ts +14 -0
  90. package/dist/core/parser/ByteStream.d.ts +26 -0
  91. package/dist/core/parser/PDFObjectParser.d.ts +31 -0
  92. package/dist/core/parser/PDFObjectStreamParser.d.ts +13 -0
  93. package/dist/core/parser/PDFParser.d.ts +46 -0
  94. package/dist/core/parser/PDFXRefStreamParser.d.ts +21 -0
  95. package/dist/core/streams/Ascii85Stream.d.ts +9 -0
  96. package/dist/core/streams/AsciiHexStream.d.ts +9 -0
  97. package/dist/core/streams/DecodeStream.d.ts +26 -0
  98. package/dist/core/streams/DecryptStream.d.ts +12 -0
  99. package/dist/core/streams/FlateStream.d.ts +13 -0
  100. package/dist/core/streams/LZWStream.d.ts +12 -0
  101. package/dist/core/streams/RunLengthStream.d.ts +8 -0
  102. package/dist/core/streams/Stream.d.ts +34 -0
  103. package/dist/core/streams/decode.d.ts +3 -0
  104. package/dist/core/structures/PDFCatalog.d.ts +27 -0
  105. package/dist/core/structures/PDFContentStream.d.ts +15 -0
  106. package/dist/core/structures/PDFCrossRefStream.d.ts +53 -0
  107. package/dist/core/structures/PDFFlateStream.d.ts +13 -0
  108. package/dist/core/structures/PDFObjectStream.d.ts +20 -0
  109. package/dist/core/structures/PDFPageLeaf.d.ts +54 -0
  110. package/dist/core/structures/PDFPageTree.d.ts +41 -0
  111. package/dist/core/syntax/CharCodes.d.ts +61 -0
  112. package/dist/core/syntax/Delimiters.d.ts +1 -0
  113. package/dist/core/syntax/Irregular.d.ts +1 -0
  114. package/dist/core/syntax/Keywords.d.ts +22 -0
  115. package/dist/core/syntax/Numeric.d.ts +3 -0
  116. package/dist/core/syntax/Whitespace.d.ts +1 -0
  117. package/dist/core/writers/PDFStreamWriter.d.ts +19 -0
  118. package/dist/core/writers/PDFWriter.d.ts +29 -0
  119. package/dist/index.js +19124 -0
  120. package/dist/index.js.map +1 -0
  121. package/dist/types/fontkit.d.ts +597 -0
  122. package/{src/types/index.ts → dist/types/index.d.ts} +8 -13
  123. package/{src/types/matrix.ts → dist/types/matrix.d.ts} +1 -2
  124. package/dist/utils/Cache.d.ts +10 -0
  125. package/dist/utils/arrays.d.ts +16 -0
  126. package/dist/utils/async.d.ts +5 -0
  127. package/dist/utils/base64.d.ts +10 -0
  128. package/dist/utils/elements/Arc.d.ts +22 -0
  129. package/dist/utils/elements/Circle.d.ts +14 -0
  130. package/dist/utils/elements/Ellipse.d.ts +20 -0
  131. package/dist/utils/elements/GraphElement.d.ts +6 -0
  132. package/dist/utils/elements/Line.d.ts +23 -0
  133. package/dist/utils/elements/Plot.d.ts +11 -0
  134. package/dist/utils/elements/Point.d.ts +18 -0
  135. package/dist/utils/elements/Rectangle.d.ts +21 -0
  136. package/dist/utils/elements/Segment.d.ts +19 -0
  137. package/dist/utils/errors.d.ts +1 -0
  138. package/dist/utils/intersections.d.ts +9 -0
  139. package/dist/utils/maths.d.ts +45 -0
  140. package/dist/utils/numbers.d.ts +23 -0
  141. package/dist/utils/objects.d.ts +15 -0
  142. package/dist/utils/pdfDocEncoding.d.ts +7 -0
  143. package/dist/utils/png.d.ts +17 -0
  144. package/dist/utils/rng.d.ts +13 -0
  145. package/dist/utils/strings.d.ts +25 -0
  146. package/{src/utils/unicode.ts → dist/utils/unicode.d.ts} +8 -195
  147. package/dist/utils/validators.d.ts +26 -0
  148. package/package.json +6 -1
  149. package/__tests__/api/PDFDocument.spec.ts +0 -576
  150. package/__tests__/api/PDFImage.spec.ts +0 -60
  151. package/__tests__/api/PDFPage.spec.ts +0 -151
  152. package/__tests__/api/form/PDFCheckBox.spec.ts +0 -71
  153. package/__tests__/api/form/PDFDropdown.spec.ts +0 -118
  154. package/__tests__/api/form/PDFForm.spec.ts +0 -370
  155. package/__tests__/api/form/PDFOptionList.spec.ts +0 -104
  156. package/__tests__/api/form/PDFRadioGroup.spec.ts +0 -183
  157. package/__tests__/api/form/PDFTextField.spec.ts +0 -148
  158. package/__tests__/api/svgPath.spec.ts +0 -153
  159. package/__tests__/api/text/layout.spec.ts +0 -166
  160. package/__tests__/core/PDFContext.spec.ts +0 -194
  161. package/__tests__/core/PDFObjectCopier.spec.ts +0 -421
  162. package/__tests__/core/acroform/PDFAcroField.spec.ts +0 -98
  163. package/__tests__/core/acroform/PDFAcroTerminal.spec.ts +0 -39
  164. package/__tests__/core/annotation/PDFWidgetAnnotation.spec.ts +0 -40
  165. package/__tests__/core/document/PDFCrossRefSection.spec.ts +0 -88
  166. package/__tests__/core/document/PDFHeader.spec.ts +0 -22
  167. package/__tests__/core/document/PDFTrailer.spec.ts +0 -28
  168. package/__tests__/core/document/PDFTrailerDict.spec.ts +0 -24
  169. package/__tests__/core/embedders/CMap.spec.ts +0 -47
  170. package/__tests__/core/embedders/CustomFontEmbedder.spec.ts +0 -96
  171. package/__tests__/core/embedders/CustomFontSubsetEmbedder.spec.ts +0 -62
  172. package/__tests__/core/embedders/FileEmbedder.spec.ts +0 -54
  173. package/__tests__/core/embedders/JpegEmbedder.spec.ts +0 -67
  174. package/__tests__/core/embedders/PDFPageEmbedder.spec.ts +0 -65
  175. package/__tests__/core/embedders/PngEmbedder.spec.ts +0 -87
  176. package/__tests__/core/embedders/StandardFontEmbedder.spec.ts +0 -79
  177. package/__tests__/core/embedders/data/SourceHanSerifJP-Regular.otf.cmap +0 -16096
  178. package/__tests__/core/embedders/data/Ubuntu-R.ttf.cmap +0 -1211
  179. package/__tests__/core/objects/PDFArray.spec.ts +0 -134
  180. package/__tests__/core/objects/PDFBool.spec.ts +0 -42
  181. package/__tests__/core/objects/PDFDict.spec.ts +0 -195
  182. package/__tests__/core/objects/PDFHexString.spec.ts +0 -168
  183. package/__tests__/core/objects/PDFInvalidObject.spec.ts +0 -32
  184. package/__tests__/core/objects/PDFName.spec.ts +0 -122
  185. package/__tests__/core/objects/PDFNull.spec.ts +0 -30
  186. package/__tests__/core/objects/PDFNumber.spec.ts +0 -50
  187. package/__tests__/core/objects/PDFObject.spec.ts +0 -29
  188. package/__tests__/core/objects/PDFRawStream.spec.ts +0 -45
  189. package/__tests__/core/objects/PDFRef.spec.ts +0 -60
  190. package/__tests__/core/objects/PDFString.spec.ts +0 -237
  191. package/__tests__/core/operators/PDFOperator.spec.ts +0 -77
  192. package/__tests__/core/parser/PDFObjectParser.spec.ts +0 -730
  193. package/__tests__/core/parser/PDFObjectStreamParser.spec.ts +0 -158
  194. package/__tests__/core/parser/PDFParser.spec.ts +0 -398
  195. package/__tests__/core/parser/PDFXRefStreamParser.spec.ts +0 -187
  196. package/__tests__/core/parser/data/object-stream-invalid +0 -2
  197. package/__tests__/core/parser/data/object-stream1 +0 -16
  198. package/__tests__/core/parser/data/object-stream2 +0 -10
  199. package/__tests__/core/parser/data/object-stream3 +0 -0
  200. package/__tests__/core/parser/data/object-stream4 +0 -0
  201. package/__tests__/core/parser/data/xref-stream1 +0 -0
  202. package/__tests__/core/parser/data/xref-stream2 +0 -0
  203. package/__tests__/core/parser/data/xref-stream3 +0 -0
  204. package/__tests__/core/parser/data/xref-stream4 +0 -0
  205. package/__tests__/core/streams/Ascii85Stream.spec.ts +0 -20
  206. package/__tests__/core/streams/AsciiHexStream.spec.ts +0 -20
  207. package/__tests__/core/streams/FlateStream.spec.ts +0 -20
  208. package/__tests__/core/streams/LZWStream.spec.ts +0 -20
  209. package/__tests__/core/streams/RunLengthStream.spec.ts +0 -20
  210. package/__tests__/core/streams/Stream.spec.ts +0 -128
  211. package/__tests__/core/streams/data/ascii85/1.decoded +0 -0
  212. package/__tests__/core/streams/data/ascii85/1.encoded +0 -43
  213. package/__tests__/core/streams/data/asciihex/1.decoded +0 -1
  214. package/__tests__/core/streams/data/asciihex/1.encoded +0 -1
  215. package/__tests__/core/streams/data/asciihex/2.decoded +0 -7
  216. package/__tests__/core/streams/data/asciihex/2.encoded +0 -1
  217. package/__tests__/core/streams/data/flate/1.corrupt.encoded +0 -1
  218. package/__tests__/core/streams/data/flate/1.decoded +0 -0
  219. package/__tests__/core/streams/data/flate/1.encoded +0 -2
  220. package/__tests__/core/streams/data/flate/2.decoded +0 -33
  221. package/__tests__/core/streams/data/flate/2.encoded +0 -0
  222. package/__tests__/core/streams/data/flate/3.decoded +0 -15
  223. package/__tests__/core/streams/data/flate/3.encoded +0 -0
  224. package/__tests__/core/streams/data/flate/4.decoded +0 -16
  225. package/__tests__/core/streams/data/flate/4.encoded +0 -0
  226. package/__tests__/core/streams/data/flate/5.decoded +0 -0
  227. package/__tests__/core/streams/data/flate/5.encoded +0 -0
  228. package/__tests__/core/streams/data/flate/6.decoded +0 -17
  229. package/__tests__/core/streams/data/flate/6.encoded +0 -0
  230. package/__tests__/core/streams/data/flate/7.decoded +0 -20
  231. package/__tests__/core/streams/data/flate/7.encoded +0 -1
  232. package/__tests__/core/streams/data/lzw/1.decoded +0 -0
  233. package/__tests__/core/streams/data/lzw/1.encoded +0 -0
  234. package/__tests__/core/streams/data/lzw/2.decoded +0 -0
  235. package/__tests__/core/streams/data/lzw/2.encoded +0 -0
  236. package/__tests__/core/streams/data/lzw/3.decoded +0 -14
  237. package/__tests__/core/streams/data/lzw/3.encoded +0 -2
  238. package/__tests__/core/streams/data/lzw/4.decoded +0 -14
  239. package/__tests__/core/streams/data/lzw/4.encoded +0 -2
  240. package/__tests__/core/streams/data/runlength/1.decoded +0 -1
  241. package/__tests__/core/streams/data/runlength/1.encoded +0 -1
  242. package/__tests__/core/streams/data/runlength/2.decoded +0 -1
  243. package/__tests__/core/streams/data/runlength/2.encoded +0 -1
  244. package/__tests__/core/streams/data/runlength/3.decoded +0 -0
  245. package/__tests__/core/streams/data/runlength/3.encoded +0 -0
  246. package/__tests__/core/streams/data/runlength/4.decoded +0 -1
  247. package/__tests__/core/streams/data/runlength/4.encoded +0 -1
  248. package/__tests__/core/streams/data/runlength/5.decoded +0 -1
  249. package/__tests__/core/streams/data/runlength/5.encoded +0 -1
  250. package/__tests__/core/streams/data/runlength/empty.encoded +0 -1
  251. package/__tests__/core/structures/PDFCatalog.spec.ts +0 -108
  252. package/__tests__/core/structures/PDFContentStream.spec.ts +0 -117
  253. package/__tests__/core/structures/PDFCrossRefStream.spec.ts +0 -145
  254. package/__tests__/core/structures/PDFObjectStream.spec.ts +0 -138
  255. package/__tests__/core/structures/PDFPageLeaf.spec.ts +0 -355
  256. package/__tests__/core/structures/PDFPageTree.spec.ts +0 -592
  257. package/__tests__/core/writers/PDFStreamWriter.spec.ts +0 -71
  258. package/__tests__/core/writers/PDFWriter.spec.ts +0 -144
  259. package/__tests__/core/writers/data/stream-writer-1.pdf +0 -0
  260. package/__tests__/index.test.ts +0 -12
  261. package/__tests__/utils/base64.spec.ts +0 -61
  262. package/__tests__/utils/data/simple.pdf +0 -201
  263. package/__tests__/utils/data/simple.pdf.base64 +0 -1
  264. package/__tests__/utils/pdfDocEncoding.spec.ts +0 -82
  265. package/__tests__/utils/png.spec.ts +0 -53
  266. package/__tests__/utils/rng.spec.ts +0 -14
  267. package/__tests__/utils/strings.spec.ts +0 -98
  268. package/__tests__/utils/unicode.spec.ts +0 -337
  269. package/assets/fonts/source_hans_jp/SourceHanSerifJP-Regular.otf +0 -0
  270. package/assets/fonts/ubuntu/Ubuntu-B.ttf +0 -0
  271. package/assets/fonts/ubuntu/Ubuntu-R.ttf +0 -0
  272. package/assets/images/cat_riding_unicorn.jpg +0 -0
  273. package/assets/images/cmyk_colorspace.jpg +0 -0
  274. package/assets/images/greyscale_bird.png +0 -0
  275. package/assets/images/minions_banana_alpha.png +0 -0
  276. package/assets/images/minions_banana_no_alpha.png +0 -0
  277. package/assets/images/minions_laughing.jpg +0 -0
  278. package/assets/pdfs/bixby_guide.pdf +0 -0
  279. package/assets/pdfs/encrypted_new.pdf +0 -0
  280. package/assets/pdfs/encrypted_old.pdf +0 -0
  281. package/assets/pdfs/fancy_fields.pdf +0 -0
  282. package/assets/pdfs/giraffe.pdf +0 -0
  283. package/assets/pdfs/invalid_root_ref.pdf +0 -0
  284. package/assets/pdfs/just_metadata.pdf +0 -49
  285. package/assets/pdfs/missing_endobj_keyword.pdf +0 -70
  286. package/assets/pdfs/missing_xref_trailer_dict.pdf +0 -141
  287. package/assets/pdfs/normal.pdf +0 -0
  288. package/assets/pdfs/pdf20examples/PDF 2.0 with offset start.pdf +0 -179
  289. package/assets/pdfs/stuff_following_header.pdf +0 -0
  290. package/assets/pdfs/us_constitution.pdf +0 -0
  291. package/assets/pdfs/with_comments.pdf +0 -0
  292. package/assets/pdfs/with_invalid_objects.pdf +0 -53
  293. package/assets/pdfs/with_invalid_stream_EOL.pdf +0 -0
  294. package/assets/pdfs/with_null_parent_entry.pdf +0 -0
  295. package/assets/pdfs/with_signature.pdf +0 -0
  296. package/assets/pdfs/with_update_sections.pdf +0 -0
  297. package/assets/pdfs/with_viewer_prefs.pdf +0 -0
  298. package/assets/pdfs/with_xfa_fields.pdf +0 -0
  299. package/src/api/PDFDocument.ts +0 -1389
  300. package/src/api/PDFDocumentOptions.ts +0 -45
  301. package/src/api/PDFEmbeddedFile.ts +0 -87
  302. package/src/api/PDFEmbeddedPage.ts +0 -100
  303. package/src/api/PDFFont.ts +0 -149
  304. package/src/api/PDFImage.ts +0 -143
  305. package/src/api/PDFJavaScript.ts +0 -75
  306. package/src/api/PDFPage.ts +0 -1604
  307. package/src/api/PDFPageOptions.ts +0 -175
  308. package/src/api/StandardFonts.ts +0 -16
  309. package/src/api/colors.ts +0 -109
  310. package/src/api/errors.ts +0 -110
  311. package/src/api/form/PDFButton.ts +0 -242
  312. package/src/api/form/PDFCheckBox.ts +0 -247
  313. package/src/api/form/PDFDropdown.ts +0 -637
  314. package/src/api/form/PDFField.ts +0 -491
  315. package/src/api/form/PDFForm.ts +0 -842
  316. package/src/api/form/PDFOptionList.ts +0 -555
  317. package/src/api/form/PDFRadioGroup.ts +0 -455
  318. package/src/api/form/PDFSignature.ts +0 -44
  319. package/src/api/form/PDFTextField.ts +0 -811
  320. package/src/api/form/appearances.ts +0 -655
  321. package/src/api/image/alignment.ts +0 -5
  322. package/src/api/objects.ts +0 -10
  323. package/src/api/operations.ts +0 -873
  324. package/src/api/operators.ts +0 -335
  325. package/src/api/rotations.ts +0 -84
  326. package/src/api/sizes.ts +0 -52
  327. package/src/api/svg.ts +0 -888
  328. package/src/api/svgPath.ts +0 -460
  329. package/src/api/text/alignment.ts +0 -5
  330. package/src/api/text/layout.ts +0 -328
  331. package/src/core/PDFContext.ts +0 -274
  332. package/src/core/PDFObjectCopier.ts +0 -142
  333. package/src/core/acroform/PDFAcroButton.ts +0 -104
  334. package/src/core/acroform/PDFAcroCheckBox.ts +0 -48
  335. package/src/core/acroform/PDFAcroChoice.ts +0 -143
  336. package/src/core/acroform/PDFAcroComboBox.ts +0 -21
  337. package/src/core/acroform/PDFAcroField.ts +0 -168
  338. package/src/core/acroform/PDFAcroForm.ts +0 -96
  339. package/src/core/acroform/PDFAcroListBox.ts +0 -19
  340. package/src/core/acroform/PDFAcroNonTerminal.ts +0 -33
  341. package/src/core/acroform/PDFAcroPushButton.ts +0 -21
  342. package/src/core/acroform/PDFAcroRadioButton.ts +0 -57
  343. package/src/core/acroform/PDFAcroTerminal.ts +0 -70
  344. package/src/core/acroform/PDFAcroText.ts +0 -76
  345. package/src/core/acroform/flags.ts +0 -162
  346. package/src/core/acroform/utils.ts +0 -129
  347. package/src/core/annotation/AppearanceCharacteristics.ts +0 -133
  348. package/src/core/annotation/BorderStyle.ts +0 -31
  349. package/src/core/annotation/PDFAnnotation.ts +0 -148
  350. package/src/core/annotation/PDFWidgetAnnotation.ts +0 -111
  351. package/src/core/annotation/flags.ts +0 -90
  352. package/src/core/crypto.ts +0 -1844
  353. package/src/core/document/PDFCrossRefSection.ts +0 -161
  354. package/src/core/document/PDFHeader.ts +0 -48
  355. package/src/core/document/PDFTrailer.ts +0 -48
  356. package/src/core/document/PDFTrailerDict.ts +0 -39
  357. package/src/core/embedders/CMap.ts +0 -65
  358. package/src/core/embedders/CustomFontEmbedder.ts +0 -237
  359. package/src/core/embedders/CustomFontSubsetEmbedder.ts +0 -89
  360. package/src/core/embedders/FileEmbedder.ts +0 -77
  361. package/src/core/embedders/FontFlags.ts +0 -45
  362. package/src/core/embedders/JavaScriptEmbedder.ts +0 -34
  363. package/src/core/embedders/JpegEmbedder.ts +0 -118
  364. package/src/core/embedders/PDFPageEmbedder.ts +0 -139
  365. package/src/core/embedders/PngEmbedder.ts +0 -69
  366. package/src/core/embedders/StandardFontEmbedder.ts +0 -121
  367. package/src/core/errors.ts +0 -226
  368. package/src/core/interactive/ViewerPreferences.ts +0 -565
  369. package/src/core/objects/PDFArray.ts +0 -179
  370. package/src/core/objects/PDFBool.ts +0 -53
  371. package/src/core/objects/PDFDict.ts +0 -220
  372. package/src/core/objects/PDFHexString.ts +0 -94
  373. package/src/core/objects/PDFInvalidObject.ts +0 -34
  374. package/src/core/objects/PDFName.ts +0 -152
  375. package/src/core/objects/PDFNull.ts +0 -30
  376. package/src/core/objects/PDFNumber.ts +0 -44
  377. package/src/core/objects/PDFObject.ts +0 -22
  378. package/src/core/objects/PDFRawStream.ts +0 -41
  379. package/src/core/objects/PDFRef.ts +0 -51
  380. package/src/core/objects/PDFStream.ts +0 -87
  381. package/src/core/objects/PDFString.ts +0 -118
  382. package/src/core/operators/PDFOperator.ts +0 -72
  383. package/src/core/operators/PDFOperatorNames.ts +0 -92
  384. package/src/core/parser/BaseParser.ts +0 -119
  385. package/src/core/parser/ByteStream.ts +0 -76
  386. package/src/core/parser/PDFObjectParser.ts +0 -302
  387. package/src/core/parser/PDFObjectStreamParser.ts +0 -65
  388. package/src/core/parser/PDFParser.ts +0 -363
  389. package/src/core/parser/PDFXRefStreamParser.ts +0 -129
  390. package/src/core/streams/Ascii85Stream.ts +0 -97
  391. package/src/core/streams/AsciiHexStream.ts +0 -77
  392. package/src/core/streams/DecodeStream.ts +0 -188
  393. package/src/core/streams/DecryptStream.ts +0 -49
  394. package/src/core/streams/FlateStream.ts +0 -397
  395. package/src/core/streams/LZWStream.ts +0 -157
  396. package/src/core/streams/RunLengthStream.ts +0 -55
  397. package/src/core/streams/Stream.ts +0 -126
  398. package/src/core/streams/decode.ts +0 -70
  399. package/src/core/structures/PDFCatalog.ts +0 -81
  400. package/src/core/structures/PDFContentStream.ts +0 -58
  401. package/src/core/structures/PDFCrossRefStream.ts +0 -238
  402. package/src/core/structures/PDFFlateStream.ts +0 -40
  403. package/src/core/structures/PDFObjectStream.ts +0 -91
  404. package/src/core/structures/PDFPageLeaf.ts +0 -244
  405. package/src/core/structures/PDFPageTree.ts +0 -192
  406. package/src/core/syntax/CharCodes.ts +0 -62
  407. package/src/core/syntax/Delimiters.ts +0 -14
  408. package/src/core/syntax/Irregular.ts +0 -10
  409. package/src/core/syntax/Keywords.ts +0 -57
  410. package/src/core/syntax/Numeric.ts +0 -26
  411. package/src/core/syntax/Whitespace.ts +0 -10
  412. package/src/core/writers/PDFStreamWriter.ts +0 -114
  413. package/src/core/writers/PDFWriter.ts +0 -146
  414. package/src/types/fontkit.ts +0 -643
  415. package/src/utils/Cache.ts +0 -26
  416. package/src/utils/arrays.ts +0 -153
  417. package/src/utils/async.ts +0 -8
  418. package/src/utils/base64.ts +0 -98
  419. package/src/utils/elements/Arc.ts +0 -97
  420. package/src/utils/elements/Circle.ts +0 -47
  421. package/src/utils/elements/Ellipse.ts +0 -117
  422. package/src/utils/elements/GraphElement.ts +0 -14
  423. package/src/utils/elements/Line.ts +0 -83
  424. package/src/utils/elements/Plot.ts +0 -50
  425. package/src/utils/elements/Point.ts +0 -37
  426. package/src/utils/elements/Rectangle.ts +0 -65
  427. package/src/utils/elements/Segment.ts +0 -81
  428. package/src/utils/errors.ts +0 -3
  429. package/src/utils/intersections.ts +0 -237
  430. package/src/utils/maths.ts +0 -96
  431. package/src/utils/numbers.ts +0 -55
  432. package/src/utils/objects.ts +0 -13
  433. package/src/utils/pdfDocEncoding.ts +0 -69
  434. package/src/utils/png.ts +0 -100
  435. package/src/utils/rng.ts +0 -21
  436. package/src/utils/strings.ts +0 -191
  437. package/src/utils/validators.ts +0 -192
  438. package/tsconfig.build.json +0 -14
  439. package/tsconfig.json +0 -15
  440. package/vite.config.mts +0 -39
  441. /package/{src/api/form/index.ts → dist/api/form/index.d.ts} +0 -0
  442. /package/{src/api/image/index.ts → dist/api/image/index.d.ts} +0 -0
  443. /package/{src/api/index.ts → dist/api/index.d.ts} +0 -0
  444. /package/{src/api/text/index.ts → dist/api/text/index.d.ts} +0 -0
  445. /package/{src/core/acroform/index.ts → dist/core/acroform/index.d.ts} +0 -0
  446. /package/{src/core/annotation/index.ts → dist/core/annotation/index.d.ts} +0 -0
  447. /package/{src/index.ts → dist/index.d.ts} +0 -0
  448. /package/{src/utils/elements/index.ts → dist/utils/elements/index.d.ts} +0 -0
  449. /package/{src/utils/index.ts → dist/utils/index.d.ts} +0 -0
@@ -0,0 +1,347 @@
1
+ import PDFArray from '../objects/PDFArray';
2
+ import PDFBool from '../objects/PDFBool';
3
+ import PDFDict from '../objects/PDFDict';
4
+ import PDFName from '../objects/PDFName';
5
+ import PDFNumber from '../objects/PDFNumber';
6
+ import PDFContext from '../PDFContext';
7
+ export declare enum NonFullScreenPageMode {
8
+ /**
9
+ * After exiting FullScreen mode, neither the document outline nor thumbnail
10
+ * images should be visible.
11
+ */
12
+ UseNone = "UseNone",
13
+ /** After exiting FullScreen mode, the document outline should be visible. */
14
+ UseOutlines = "UseOutlines",
15
+ /** After exiting FullScreen mode, thumbnail images should be visible. */
16
+ UseThumbs = "UseThumbs",
17
+ /**
18
+ * After exiting FullScreen mode, the optional content group panel should be
19
+ * visible.
20
+ */
21
+ UseOC = "UseOC"
22
+ }
23
+ export declare enum ReadingDirection {
24
+ /** The predominant reading order is Left to Right. */
25
+ L2R = "L2R",
26
+ /**
27
+ * The predominant reading order is Right to left (including vertical writing
28
+ * systems, such as Chinese, Japanese and Korean).
29
+ */
30
+ R2L = "R2L"
31
+ }
32
+ export declare enum PrintScaling {
33
+ /** No page scaling. */
34
+ None = "None",
35
+ AppDefault = "AppDefault"
36
+ }
37
+ export declare enum Duplex {
38
+ /** The PDF reader should print single-sided. */
39
+ Simplex = "Simplex",
40
+ /**
41
+ * The PDF reader should print double sided and flip on the short edge of the
42
+ * sheet.
43
+ */
44
+ DuplexFlipShortEdge = "DuplexFlipShortEdge",
45
+ /**
46
+ * The PDF reader should print double sided and flip on the long edge of the
47
+ * sheet.
48
+ */
49
+ DuplexFlipLongEdge = "DuplexFlipLongEdge"
50
+ }
51
+ type BoolViewerPrefKey = 'HideToolbar' | 'HideMenubar' | 'HideWindowUI' | 'FitWindow' | 'CenterWindow' | 'DisplayDocTitle' | 'PickTrayByPDFSize';
52
+ type NameViewerPrefKey = 'NonFullScreenPageMode' | 'Direction' | 'PrintScaling' | 'Duplex';
53
+ interface PageRange {
54
+ start: number;
55
+ end: number;
56
+ }
57
+ declare class ViewerPreferences {
58
+ /** @ignore */
59
+ readonly dict: PDFDict;
60
+ /** @ignore */
61
+ static fromDict: (dict: PDFDict) => ViewerPreferences;
62
+ /** @ignore */
63
+ static create: (context: PDFContext) => ViewerPreferences;
64
+ /** @ignore */
65
+ protected constructor(dict: PDFDict);
66
+ protected lookupBool(key: BoolViewerPrefKey): PDFBool | undefined;
67
+ protected lookupName(key: NameViewerPrefKey): PDFName | undefined;
68
+ /** @ignore */
69
+ HideToolbar(): PDFBool | undefined;
70
+ /** @ignore */
71
+ HideMenubar(): PDFBool | undefined;
72
+ /** @ignore */
73
+ HideWindowUI(): PDFBool | undefined;
74
+ /** @ignore */
75
+ FitWindow(): PDFBool | undefined;
76
+ /** @ignore */
77
+ CenterWindow(): PDFBool | undefined;
78
+ /** @ignore */
79
+ DisplayDocTitle(): PDFBool | undefined;
80
+ /** @ignore */
81
+ NonFullScreenPageMode(): PDFName | undefined;
82
+ /** @ignore */
83
+ Direction(): PDFName | undefined;
84
+ /** @ignore */
85
+ PrintScaling(): PDFName | undefined;
86
+ /** @ignore */
87
+ Duplex(): PDFName | undefined;
88
+ /** @ignore */
89
+ PickTrayByPDFSize(): PDFBool | undefined;
90
+ /** @ignore */
91
+ PrintPageRange(): PDFArray | undefined;
92
+ /** @ignore */
93
+ NumCopies(): PDFNumber | undefined;
94
+ /**
95
+ * Returns `true` if PDF readers should hide the toolbar menus when displaying
96
+ * this document.
97
+ * @returns Whether or not toolbars should be hidden.
98
+ */
99
+ getHideToolbar(): boolean;
100
+ /**
101
+ * Returns `true` if PDF readers should hide the menu bar when displaying this
102
+ * document.
103
+ * @returns Whether or not the menu bar should be hidden.
104
+ */
105
+ getHideMenubar(): boolean;
106
+ /**
107
+ * Returns `true` if PDF readers should hide the user interface elements in
108
+ * the document's window (such as scroll bars and navigation controls),
109
+ * leaving only the document's contents displayed.
110
+ * @returns Whether or not user interface elements should be hidden.
111
+ */
112
+ getHideWindowUI(): boolean;
113
+ /**
114
+ * Returns `true` if PDF readers should resize the document's window to fit
115
+ * the size of the first displayed page.
116
+ * @returns Whether or not the window should be resized to fit.
117
+ */
118
+ getFitWindow(): boolean;
119
+ /**
120
+ * Returns `true` if PDF readers should position the document's window in the
121
+ * center of the screen.
122
+ * @returns Whether or not to center the document window.
123
+ */
124
+ getCenterWindow(): boolean;
125
+ /**
126
+ * Returns `true` if the window's title bar should display the document
127
+ * `Title`, taken from the document metadata (see [[PDFDocument.getTitle]]).
128
+ * Returns `false` if the title bar should instead display the filename of the
129
+ * PDF file.
130
+ * @returns Whether to display the document title.
131
+ */
132
+ getDisplayDocTitle(): boolean;
133
+ /**
134
+ * Returns the page mode, which tells the PDF reader how to display the
135
+ * document after exiting full-screen mode.
136
+ * @returns The page mode after exiting full-screen mode.
137
+ */
138
+ getNonFullScreenPageMode(): NonFullScreenPageMode;
139
+ /**
140
+ * Returns the predominant reading order for text.
141
+ * @returns The text reading order.
142
+ */
143
+ getReadingDirection(): ReadingDirection;
144
+ /**
145
+ * Returns the page scaling option that the PDF reader should select when the
146
+ * print dialog is displayed.
147
+ * @returns The page scaling option.
148
+ */
149
+ getPrintScaling(): PrintScaling;
150
+ /**
151
+ * Returns the paper handling option that should be used when printing the
152
+ * file from the print dialog.
153
+ * @returns The paper handling option.
154
+ */
155
+ getDuplex(): Duplex | undefined;
156
+ /**
157
+ * Returns `true` if the PDF page size should be used to select the input
158
+ * paper tray.
159
+ * @returns Whether or not the PDF page size should be used to select the
160
+ * input paper tray.
161
+ */
162
+ getPickTrayByPDFSize(): boolean | undefined;
163
+ /**
164
+ * Returns an array of page number ranges, which are the values used to
165
+ * initialize the print dialog box when the file is printed. Each range
166
+ * specifies the first (`start`) and last (`end`) pages in a sub-range of
167
+ * pages to be printed. The first page of the PDF file is denoted by 0.
168
+ * For example:
169
+ * ```js
170
+ * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
171
+ * const includesPage3 = viewerPrefs
172
+ * .getPrintRanges()
173
+ * .some(pr => pr.start =< 2 && pr.end >= 2)
174
+ * if (includesPage3) console.log('printRange includes page 3')
175
+ * ```
176
+ * @returns An array of objects, each with the properties `start` and `end`,
177
+ * denoting page indices. If not, specified an empty array is
178
+ * returned.
179
+ */
180
+ getPrintPageRange(): PageRange[];
181
+ /**
182
+ * Returns the number of copies to be printed when the print dialog is opened
183
+ * for this document.
184
+ * @returns The default number of copies to be printed.
185
+ */
186
+ getNumCopies(): number;
187
+ /**
188
+ * Choose whether the PDF reader's toolbars should be hidden while the
189
+ * document is active.
190
+ * @param hideToolbar `true` if the toolbar should be hidden.
191
+ */
192
+ setHideToolbar(hideToolbar: boolean): void;
193
+ /**
194
+ * Choose whether the PDF reader's menu bar should be hidden while the
195
+ * document is active.
196
+ * @param hideMenubar `true` if the menu bar should be hidden.
197
+ */
198
+ setHideMenubar(hideMenubar: boolean): void;
199
+ /**
200
+ * Choose whether the PDF reader should hide user interface elements in the
201
+ * document's window (such as scroll bars and navigation controls), leaving
202
+ * only the document's contents displayed.
203
+ * @param hideWindowUI `true` if the user interface elements should be hidden.
204
+ */
205
+ setHideWindowUI(hideWindowUI: boolean): void;
206
+ /**
207
+ * Choose whether the PDF reader should resize the document's window to fit
208
+ * the size of the first displayed page.
209
+ * @param fitWindow `true` if the window should be resized.
210
+ */
211
+ setFitWindow(fitWindow: boolean): void;
212
+ /**
213
+ * Choose whether the PDF reader should position the document's window in the
214
+ * center of the screen.
215
+ * @param centerWindow `true` if the window should be centered.
216
+ */
217
+ setCenterWindow(centerWindow: boolean): void;
218
+ /**
219
+ * Choose whether the window's title bar should display the document `Title`
220
+ * taken from the document metadata (see [[PDFDocument.setTitle]]). If
221
+ * `false`, the title bar should instead display the PDF filename.
222
+ * @param displayTitle `true` if the document title should be displayed.
223
+ */
224
+ setDisplayDocTitle(displayTitle: boolean): void;
225
+ /**
226
+ * Choose how the PDF reader should display the document upon exiting
227
+ * full-screen mode. This entry is meaningful only if the value of the
228
+ * `PageMode` entry in the document's [[PDFCatalog]] is `FullScreen`.
229
+ *
230
+ * For example:
231
+ * ```js
232
+ * import { PDFDocument, NonFullScreenPageMode, PDFName } from 'pdf-lib'
233
+ *
234
+ * const pdfDoc = await PDFDocument.create()
235
+ *
236
+ * // Set the PageMode
237
+ * pdfDoc.catalog.set(PDFName.of('PageMode'),PDFName.of('FullScreen'))
238
+ *
239
+ * // Set what happens when full-screen is closed
240
+ * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
241
+ * viewerPrefs.setNonFullScreenPageMode(NonFullScreenPageMode.UseOutlines)
242
+ * ```
243
+ *
244
+ * @param nonFullScreenPageMode How the document should be displayed upon
245
+ * exiting full screen mode.
246
+ */
247
+ setNonFullScreenPageMode(nonFullScreenPageMode: NonFullScreenPageMode): void;
248
+ /**
249
+ * Choose the predominant reading order for text.
250
+ *
251
+ * This entry has no direct effect on the document's contents or page
252
+ * numbering, but may be used to determine the relative positioning of pages
253
+ * when displayed side by side or printed n-up.
254
+ *
255
+ * For example:
256
+ * ```js
257
+ * import { PDFDocument, ReadingDirection } from 'pdf-lib'
258
+ *
259
+ * const pdfDoc = await PDFDocument.create()
260
+ * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
261
+ * viewerPrefs.setReadingDirection(ReadingDirection.R2L)
262
+ * ```
263
+ *
264
+ * @param readingDirection The reading order for text.
265
+ */
266
+ setReadingDirection(readingDirection: ReadingDirection): void;
267
+ /**
268
+ * Choose the page scaling option that should be selected when a print dialog
269
+ * is displayed for this document.
270
+ *
271
+ * For example:
272
+ * ```js
273
+ * import { PDFDocument, PrintScaling } from 'pdf-lib'
274
+ *
275
+ * const pdfDoc = await PDFDocument.create()
276
+ * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
277
+ * viewerPrefs.setPrintScaling(PrintScaling.None)
278
+ * ```
279
+ *
280
+ * @param printScaling The print scaling option.
281
+ */
282
+ setPrintScaling(printScaling: PrintScaling): void;
283
+ /**
284
+ * Choose the paper handling option that should be selected by default in the
285
+ * print dialog.
286
+ *
287
+ * For example:
288
+ * ```js
289
+ * import { PDFDocument, Duplex } from 'pdf-lib'
290
+ *
291
+ * const pdfDoc = await PDFDocument.create()
292
+ * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
293
+ * viewerPrefs.setDuplex(Duplex.DuplexFlipShortEdge)
294
+ * ```
295
+ *
296
+ * @param duplex The double or single sided printing option.
297
+ */
298
+ setDuplex(duplex: Duplex): void;
299
+ /**
300
+ * Choose whether the PDF document's page size should be used to select the
301
+ * input paper tray when printing. This setting influences only the preset
302
+ * values used to populate the print dialog presented by a PDF reader.
303
+ *
304
+ * If PickTrayByPDFSize is true, the check box in the print dialog associated
305
+ * with input paper tray should be checked. This setting has no effect on
306
+ * operating systems that do not provide the ability to pick the input tray
307
+ * by size.
308
+ *
309
+ * @param pickTrayByPDFSize `true` if the document's page size should be used
310
+ * to select the input paper tray.
311
+ */
312
+ setPickTrayByPDFSize(pickTrayByPDFSize: boolean): void;
313
+ /**
314
+ * Choose the page numbers used to initialize the print dialog box when the
315
+ * file is printed. The first page of the PDF file is denoted by 0.
316
+ *
317
+ * For example:
318
+ * ```js
319
+ * import { PDFDocument } from 'pdf-lib'
320
+ *
321
+ * const pdfDoc = await PDFDocument.create()
322
+ * const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
323
+ *
324
+ * // We can set the default print range to only the first page
325
+ * viewerPrefs.setPrintPageRange({ start: 0, end: 0 })
326
+ *
327
+ * // Or we can supply noncontiguous ranges (e.g. pages 1, 3, and 5-7)
328
+ * viewerPrefs.setPrintPageRange([
329
+ * { start: 0, end: 0 },
330
+ * { start: 2, end: 2 },
331
+ * { start: 4, end: 6 },
332
+ * ])
333
+ * ```
334
+ *
335
+ * @param printPageRange An object or array of objects, each with the
336
+ * properties `start` and `end`, denoting a range of
337
+ * page indices.
338
+ */
339
+ setPrintPageRange(printPageRange: PageRange[] | PageRange): void;
340
+ /**
341
+ * Choose the default number of copies to be printed when the print dialog is
342
+ * opened for this file.
343
+ * @param numCopies The default number of copies.
344
+ */
345
+ setNumCopies(numCopies: number): void;
346
+ }
347
+ export default ViewerPreferences;
@@ -0,0 +1,63 @@
1
+ import PDFBool from './PDFBool';
2
+ import PDFDict from './PDFDict';
3
+ import PDFHexString from './PDFHexString';
4
+ import PDFName from './PDFName';
5
+ import PDFNull from './PDFNull';
6
+ import PDFNumber from './PDFNumber';
7
+ import PDFObject from './PDFObject';
8
+ import PDFRef from './PDFRef';
9
+ import PDFStream from './PDFStream';
10
+ import PDFString from './PDFString';
11
+ import PDFContext from '../PDFContext';
12
+ import PDFRawStream from './PDFRawStream';
13
+ declare class PDFArray extends PDFObject {
14
+ static withContext: (context: PDFContext) => PDFArray;
15
+ private readonly array;
16
+ private readonly context;
17
+ private constructor();
18
+ size(): number;
19
+ push(object: PDFObject): void;
20
+ insert(index: number, object: PDFObject): void;
21
+ indexOf(object: PDFObject): number | undefined;
22
+ remove(index: number): void;
23
+ set(idx: number, object: PDFObject): void;
24
+ get(index: number): PDFObject;
25
+ lookupMaybe(index: number, type: typeof PDFArray): PDFArray | undefined;
26
+ lookupMaybe(index: number, type: typeof PDFBool): PDFBool | undefined;
27
+ lookupMaybe(index: number, type: typeof PDFDict): PDFDict | undefined;
28
+ lookupMaybe(index: number, type: typeof PDFHexString): PDFHexString | undefined;
29
+ lookupMaybe(index: number, type: typeof PDFName): PDFName | undefined;
30
+ lookupMaybe(index: number, type: typeof PDFNull): typeof PDFNull | undefined;
31
+ lookupMaybe(index: number, type: typeof PDFNumber): PDFNumber | undefined;
32
+ lookupMaybe(index: number, type: typeof PDFStream): PDFStream | undefined;
33
+ lookupMaybe(index: number, type: typeof PDFRawStream): PDFRawStream | undefined;
34
+ lookupMaybe(index: number, type: typeof PDFRef): PDFRef | undefined;
35
+ lookupMaybe(index: number, type: typeof PDFString): PDFString | undefined;
36
+ lookupMaybe(index: number, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined;
37
+ lookup(index: number): PDFObject | undefined;
38
+ lookup(index: number, type: typeof PDFArray): PDFArray;
39
+ lookup(index: number, type: typeof PDFBool): PDFBool;
40
+ lookup(index: number, type: typeof PDFDict): PDFDict;
41
+ lookup(index: number, type: typeof PDFHexString): PDFHexString;
42
+ lookup(index: number, type: typeof PDFName): PDFName;
43
+ lookup(index: number, type: typeof PDFNull): typeof PDFNull;
44
+ lookup(index: number, type: typeof PDFNumber): PDFNumber;
45
+ lookup(index: number, type: typeof PDFStream): PDFStream;
46
+ lookup(index: number, type: typeof PDFRawStream): PDFRawStream;
47
+ lookup(index: number, type: typeof PDFRef): PDFRef;
48
+ lookup(index: number, type: typeof PDFString): PDFString;
49
+ lookup(index: number, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString;
50
+ asRectangle(): {
51
+ x: number;
52
+ y: number;
53
+ width: number;
54
+ height: number;
55
+ };
56
+ asArray(): PDFObject[];
57
+ clone(context?: PDFContext): PDFArray;
58
+ toString(): string;
59
+ sizeInBytes(): number;
60
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
61
+ scalePDFNumbers(x: number, y: number): void;
62
+ }
63
+ export default PDFArray;
@@ -0,0 +1,13 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFBool extends PDFObject {
3
+ static readonly True: PDFBool;
4
+ static readonly False: PDFBool;
5
+ private readonly value;
6
+ private constructor();
7
+ asBoolean(): boolean;
8
+ clone(): PDFBool;
9
+ toString(): string;
10
+ sizeInBytes(): number;
11
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
12
+ }
13
+ export default PDFBool;
@@ -0,0 +1,62 @@
1
+ import PDFArray from './PDFArray';
2
+ import PDFBool from './PDFBool';
3
+ import PDFHexString from './PDFHexString';
4
+ import PDFName from './PDFName';
5
+ import PDFNull from './PDFNull';
6
+ import PDFNumber from './PDFNumber';
7
+ import PDFObject from './PDFObject';
8
+ import PDFRef from './PDFRef';
9
+ import PDFStream from './PDFStream';
10
+ import PDFString from './PDFString';
11
+ import PDFContext from '../PDFContext';
12
+ export type DictMap = Map<PDFName, PDFObject>;
13
+ declare class PDFDict extends PDFObject {
14
+ static withContext: (context: PDFContext) => PDFDict;
15
+ static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFDict;
16
+ readonly context: PDFContext;
17
+ private readonly dict;
18
+ suppressEncryption: boolean;
19
+ protected constructor(map: DictMap, context: PDFContext);
20
+ keys(): PDFName[];
21
+ values(): PDFObject[];
22
+ entries(): [PDFName, PDFObject][];
23
+ set(key: PDFName, value: PDFObject): void;
24
+ get(key: PDFName, preservePDFNull?: boolean): PDFObject | undefined;
25
+ has(key: PDFName): boolean;
26
+ lookupMaybe(key: PDFName, type: typeof PDFArray): PDFArray | undefined;
27
+ lookupMaybe(key: PDFName, type: typeof PDFBool): PDFBool | undefined;
28
+ lookupMaybe(key: PDFName, type: typeof PDFDict): PDFDict | undefined;
29
+ lookupMaybe(key: PDFName, type: typeof PDFHexString): PDFHexString | undefined;
30
+ lookupMaybe(key: PDFName, type: typeof PDFName): PDFName | undefined;
31
+ lookupMaybe(key: PDFName, type: typeof PDFNull): typeof PDFNull | undefined;
32
+ lookupMaybe(key: PDFName, type: typeof PDFNumber): PDFNumber | undefined;
33
+ lookupMaybe(key: PDFName, type: typeof PDFStream): PDFStream | undefined;
34
+ lookupMaybe(key: PDFName, type: typeof PDFRef): PDFRef | undefined;
35
+ lookupMaybe(key: PDFName, type: typeof PDFString): PDFString | undefined;
36
+ lookupMaybe(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined;
37
+ lookupMaybe(ref: PDFName, type1: typeof PDFDict, type2: typeof PDFStream): PDFDict | PDFStream | undefined;
38
+ lookupMaybe(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString, type3: typeof PDFArray): PDFString | PDFHexString | PDFArray | undefined;
39
+ lookup(key: PDFName): PDFObject | undefined;
40
+ lookup(key: PDFName, type: typeof PDFArray): PDFArray;
41
+ lookup(key: PDFName, type: typeof PDFBool): PDFBool;
42
+ lookup(key: PDFName, type: typeof PDFDict): PDFDict;
43
+ lookup(key: PDFName, type: typeof PDFHexString): PDFHexString;
44
+ lookup(key: PDFName, type: typeof PDFName): PDFName;
45
+ lookup(key: PDFName, type: typeof PDFNull): typeof PDFNull;
46
+ lookup(key: PDFName, type: typeof PDFNumber): PDFNumber;
47
+ lookup(key: PDFName, type: typeof PDFStream): PDFStream;
48
+ lookup(key: PDFName, type: typeof PDFRef): PDFRef;
49
+ lookup(key: PDFName, type: typeof PDFString): PDFString;
50
+ lookup(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString;
51
+ lookup(ref: PDFName, type1: typeof PDFDict, type2: typeof PDFStream): PDFDict | PDFStream;
52
+ lookup(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString, type3: typeof PDFArray): PDFString | PDFHexString | PDFArray;
53
+ delete(key: PDFName): boolean;
54
+ asMap(): Map<PDFName, PDFObject>;
55
+ /** Generate a random key that doesn't exist in current key set */
56
+ uniqueKey(tag?: string): PDFName;
57
+ clone(context?: PDFContext): PDFDict;
58
+ toString(): string;
59
+ sizeInBytes(): number;
60
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
61
+ }
62
+ export default PDFDict;
@@ -0,0 +1,16 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFHexString extends PDFObject {
3
+ static of: (value: string) => PDFHexString;
4
+ static fromText: (value: string) => PDFHexString;
5
+ private readonly value;
6
+ constructor(value: string);
7
+ asBytes(): Uint8Array;
8
+ decodeText(): string;
9
+ decodeDate(): Date;
10
+ asString(): string;
11
+ clone(): PDFHexString;
12
+ toString(): string;
13
+ sizeInBytes(): number;
14
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
15
+ }
16
+ export default PDFHexString;
@@ -0,0 +1,11 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFInvalidObject extends PDFObject {
3
+ static of: (data: Uint8Array) => PDFInvalidObject;
4
+ private readonly data;
5
+ private constructor();
6
+ clone(): PDFInvalidObject;
7
+ toString(): string;
8
+ sizeInBytes(): number;
9
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
10
+ }
11
+ export default PDFInvalidObject;
@@ -0,0 +1,41 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFName extends PDFObject {
3
+ static of: (name: string) => PDFName;
4
+ static readonly Length: PDFName;
5
+ static readonly FlateDecode: PDFName;
6
+ static readonly Resources: PDFName;
7
+ static readonly Font: PDFName;
8
+ static readonly XObject: PDFName;
9
+ static readonly ExtGState: PDFName;
10
+ static readonly Contents: PDFName;
11
+ static readonly Type: PDFName;
12
+ static readonly Parent: PDFName;
13
+ static readonly MediaBox: PDFName;
14
+ static readonly Page: PDFName;
15
+ static readonly Annots: PDFName;
16
+ static readonly TrimBox: PDFName;
17
+ static readonly ArtBox: PDFName;
18
+ static readonly BleedBox: PDFName;
19
+ static readonly CropBox: PDFName;
20
+ static readonly Rotate: PDFName;
21
+ static readonly Title: PDFName;
22
+ static readonly Author: PDFName;
23
+ static readonly Subject: PDFName;
24
+ static readonly Creator: PDFName;
25
+ static readonly Keywords: PDFName;
26
+ static readonly Producer: PDFName;
27
+ static readonly CreationDate: PDFName;
28
+ static readonly ModDate: PDFName;
29
+ private readonly encodedName;
30
+ private constructor();
31
+ asBytes(): Uint8Array;
32
+ decodeText(): string;
33
+ asString(): string;
34
+ /** @deprecated in favor of [[PDFName.asString]] */
35
+ value(): string;
36
+ clone(): PDFName;
37
+ toString(): string;
38
+ sizeInBytes(): number;
39
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
40
+ }
41
+ export default PDFName;
@@ -0,0 +1,10 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFNull extends PDFObject {
3
+ asNull(): null;
4
+ clone(): PDFNull;
5
+ toString(): string;
6
+ sizeInBytes(): number;
7
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
8
+ }
9
+ declare const _default: PDFNull;
10
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFNumber extends PDFObject {
3
+ static of: (value: number) => PDFNumber;
4
+ private readonly numberValue;
5
+ private readonly stringValue;
6
+ private constructor();
7
+ asNumber(): number;
8
+ /** @deprecated in favor of [[PDFNumber.asNumber]] */
9
+ value(): number;
10
+ clone(): PDFNumber;
11
+ toString(): string;
12
+ sizeInBytes(): number;
13
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
14
+ }
15
+ export default PDFNumber;
@@ -0,0 +1,8 @@
1
+ import PDFContext from '../PDFContext';
2
+ declare class PDFObject {
3
+ clone(_context?: PDFContext): PDFObject;
4
+ toString(): string;
5
+ sizeInBytes(): number;
6
+ copyBytesInto(_buffer: Uint8Array, _offset: number): number;
7
+ }
8
+ export default PDFObject;
@@ -0,0 +1,16 @@
1
+ import PDFDict from './PDFDict';
2
+ import PDFStream from './PDFStream';
3
+ import PDFContext from '../PDFContext';
4
+ import { CipherTransform } from '../crypto';
5
+ declare class PDFRawStream extends PDFStream {
6
+ static of: (dict: PDFDict, contents: Uint8Array, transform?: CipherTransform) => PDFRawStream;
7
+ readonly contents: Uint8Array;
8
+ readonly transform?: CipherTransform;
9
+ private constructor();
10
+ asUint8Array(): Uint8Array;
11
+ clone(context?: PDFContext): PDFRawStream;
12
+ getContentsString(): string;
13
+ getContents(): Uint8Array;
14
+ getContentsSize(): number;
15
+ }
16
+ export default PDFRawStream;
@@ -0,0 +1,13 @@
1
+ import PDFObject from '../objects/PDFObject';
2
+ declare class PDFRef extends PDFObject {
3
+ static of: (objectNumber: number, generationNumber?: number) => PDFRef;
4
+ readonly objectNumber: number;
5
+ readonly generationNumber: number;
6
+ readonly tag: string;
7
+ private constructor();
8
+ clone(): PDFRef;
9
+ toString(): string;
10
+ sizeInBytes(): number;
11
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
12
+ }
13
+ export default PDFRef;
@@ -0,0 +1,16 @@
1
+ import PDFDict from './PDFDict';
2
+ import PDFObject from './PDFObject';
3
+ import PDFContext from '../PDFContext';
4
+ declare class PDFStream extends PDFObject {
5
+ readonly dict: PDFDict;
6
+ constructor(dict: PDFDict);
7
+ clone(_context?: PDFContext): PDFStream;
8
+ getContentsString(): string;
9
+ getContents(): Uint8Array;
10
+ getContentsSize(): number;
11
+ updateDict(): void;
12
+ sizeInBytes(): number;
13
+ toString(): string;
14
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
15
+ }
16
+ export default PDFStream;
@@ -0,0 +1,16 @@
1
+ import PDFObject from './PDFObject';
2
+ declare class PDFString extends PDFObject {
3
+ static of: (value: string) => PDFString;
4
+ static fromDate: (date: Date) => PDFString;
5
+ private readonly value;
6
+ private constructor();
7
+ asBytes(): Uint8Array;
8
+ decodeText(): string;
9
+ decodeDate(): Date;
10
+ asString(): string;
11
+ clone(): PDFString;
12
+ toString(): string;
13
+ sizeInBytes(): number;
14
+ copyBytesInto(buffer: Uint8Array, offset: number): number;
15
+ }
16
+ export default PDFString;