@pdfme/pdf-lib 1.17.3

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 (1542) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +1513 -0
  3. package/cjs/api/Embeddable.d.ts +8 -0
  4. package/cjs/api/Embeddable.d.ts.map +1 -0
  5. package/cjs/api/Embeddable.js +3 -0
  6. package/cjs/api/Embeddable.js.map +1 -0
  7. package/cjs/api/PDFDocument.d.ts +779 -0
  8. package/cjs/api/PDFDocument.d.ts.map +1 -0
  9. package/cjs/api/PDFDocument.js +1369 -0
  10. package/cjs/api/PDFDocument.js.map +1 -0
  11. package/cjs/api/PDFDocumentOptions.d.ts +38 -0
  12. package/cjs/api/PDFDocumentOptions.d.ts.map +1 -0
  13. package/cjs/api/PDFDocumentOptions.js +11 -0
  14. package/cjs/api/PDFDocumentOptions.js.map +1 -0
  15. package/cjs/api/PDFEmbeddedFile.d.ts +39 -0
  16. package/cjs/api/PDFEmbeddedFile.d.ts.map +1 -0
  17. package/cjs/api/PDFEmbeddedFile.js +84 -0
  18. package/cjs/api/PDFEmbeddedFile.js.map +1 -0
  19. package/cjs/api/PDFEmbeddedPage.d.ts +74 -0
  20. package/cjs/api/PDFEmbeddedPage.d.ts.map +1 -0
  21. package/cjs/api/PDFEmbeddedPage.js +95 -0
  22. package/cjs/api/PDFEmbeddedPage.js.map +1 -0
  23. package/cjs/api/PDFFont.d.ts +95 -0
  24. package/cjs/api/PDFFont.d.ts.map +1 -0
  25. package/cjs/api/PDFFont.js +143 -0
  26. package/cjs/api/PDFFont.js.map +1 -0
  27. package/cjs/api/PDFImage.d.ts +96 -0
  28. package/cjs/api/PDFImage.d.ts.map +1 -0
  29. package/cjs/api/PDFImage.js +132 -0
  30. package/cjs/api/PDFImage.js.map +1 -0
  31. package/cjs/api/PDFJavaScript.d.ts +39 -0
  32. package/cjs/api/PDFJavaScript.d.ts.map +1 -0
  33. package/cjs/api/PDFJavaScript.js +73 -0
  34. package/cjs/api/PDFJavaScript.js.map +1 -0
  35. package/cjs/api/PDFPage.d.ts +898 -0
  36. package/cjs/api/PDFPage.d.ts.map +1 -0
  37. package/cjs/api/PDFPage.js +1442 -0
  38. package/cjs/api/PDFPage.js.map +1 -0
  39. package/cjs/api/PDFPageOptions.d.ts +155 -0
  40. package/cjs/api/PDFPageOptions.d.ts.map +1 -0
  41. package/cjs/api/PDFPageOptions.js +19 -0
  42. package/cjs/api/PDFPageOptions.js.map +1 -0
  43. package/cjs/api/StandardFonts.d.ts +17 -0
  44. package/cjs/api/StandardFonts.d.ts.map +1 -0
  45. package/cjs/api/StandardFonts.js +21 -0
  46. package/cjs/api/StandardFonts.js.map +1 -0
  47. package/cjs/api/colors.d.ts +31 -0
  48. package/cjs/api/colors.d.ts.map +1 -0
  49. package/cjs/api/colors.js +59 -0
  50. package/cjs/api/colors.js.map +1 -0
  51. package/cjs/api/errors.d.ts +43 -0
  52. package/cjs/api/errors.d.ts.map +1 -0
  53. package/cjs/api/errors.js +168 -0
  54. package/cjs/api/errors.js.map +1 -0
  55. package/cjs/api/form/PDFButton.d.ts +138 -0
  56. package/cjs/api/form/PDFButton.d.ts.map +1 -0
  57. package/cjs/api/form/PDFButton.js +220 -0
  58. package/cjs/api/form/PDFButton.js.map +1 -0
  59. package/cjs/api/form/PDFCheckBox.d.ts +143 -0
  60. package/cjs/api/form/PDFCheckBox.d.ts.map +1 -0
  61. package/cjs/api/form/PDFCheckBox.js +236 -0
  62. package/cjs/api/form/PDFCheckBox.js.map +1 -0
  63. package/cjs/api/form/PDFDropdown.d.ts +403 -0
  64. package/cjs/api/form/PDFDropdown.d.ts.map +1 -0
  65. package/cjs/api/form/PDFDropdown.js +580 -0
  66. package/cjs/api/form/PDFDropdown.js.map +1 -0
  67. package/cjs/api/form/PDFField.d.ts +204 -0
  68. package/cjs/api/form/PDFField.d.ts.map +1 -0
  69. package/cjs/api/form/PDFField.js +384 -0
  70. package/cjs/api/form/PDFField.js.map +1 -0
  71. package/cjs/api/form/PDFForm.d.ts +412 -0
  72. package/cjs/api/form/PDFForm.d.ts.map +1 -0
  73. package/cjs/api/form/PDFForm.js +726 -0
  74. package/cjs/api/form/PDFForm.js.map +1 -0
  75. package/cjs/api/form/PDFOptionList.d.ts +336 -0
  76. package/cjs/api/form/PDFOptionList.d.ts.map +1 -0
  77. package/cjs/api/form/PDFOptionList.js +499 -0
  78. package/cjs/api/form/PDFOptionList.js.map +1 -0
  79. package/cjs/api/form/PDFRadioGroup.d.ts +253 -0
  80. package/cjs/api/form/PDFRadioGroup.d.ts.map +1 -0
  81. package/cjs/api/form/PDFRadioGroup.js +415 -0
  82. package/cjs/api/form/PDFRadioGroup.js.map +1 -0
  83. package/cjs/api/form/PDFSignature.d.ts +30 -0
  84. package/cjs/api/form/PDFSignature.d.ts.map +1 -0
  85. package/cjs/api/form/PDFSignature.js +43 -0
  86. package/cjs/api/form/PDFSignature.js.map +1 -0
  87. package/cjs/api/form/PDFTextField.d.ts +538 -0
  88. package/cjs/api/form/PDFTextField.d.ts.map +1 -0
  89. package/cjs/api/form/PDFTextField.js +739 -0
  90. package/cjs/api/form/PDFTextField.js.map +1 -0
  91. package/cjs/api/form/appearances.d.ts +42 -0
  92. package/cjs/api/form/appearances.d.ts.map +1 -0
  93. package/cjs/api/form/appearances.js +421 -0
  94. package/cjs/api/form/appearances.js.map +1 -0
  95. package/cjs/api/form/index.d.ts +11 -0
  96. package/cjs/api/form/index.d.ts.map +1 -0
  97. package/cjs/api/form/index.js +23 -0
  98. package/cjs/api/form/index.js.map +1 -0
  99. package/cjs/api/image/alignment.d.ts +6 -0
  100. package/cjs/api/image/alignment.d.ts.map +1 -0
  101. package/cjs/api/image/alignment.js +10 -0
  102. package/cjs/api/image/alignment.js.map +1 -0
  103. package/cjs/api/image/index.d.ts +2 -0
  104. package/cjs/api/image/index.d.ts.map +1 -0
  105. package/cjs/api/image/index.js +5 -0
  106. package/cjs/api/image/index.js.map +1 -0
  107. package/cjs/api/index.d.ts +21 -0
  108. package/cjs/api/index.d.ts.map +1 -0
  109. package/cjs/api/index.js +29 -0
  110. package/cjs/api/index.js.map +1 -0
  111. package/cjs/api/objects.d.ts +5 -0
  112. package/cjs/api/objects.d.ts.map +1 -0
  113. package/cjs/api/objects.js +14 -0
  114. package/cjs/api/objects.js.map +1 -0
  115. package/cjs/api/operations.d.ts +212 -0
  116. package/cjs/api/operations.d.ts.map +1 -0
  117. package/cjs/api/operations.js +488 -0
  118. package/cjs/api/operations.js.map +1 -0
  119. package/cjs/api/operators.d.ts +86 -0
  120. package/cjs/api/operators.d.ts.map +1 -0
  121. package/cjs/api/operators.js +231 -0
  122. package/cjs/api/operators.js.map +1 -0
  123. package/cjs/api/rotations.d.ts +39 -0
  124. package/cjs/api/rotations.d.ts.map +1 -0
  125. package/cjs/api/rotations.js +71 -0
  126. package/cjs/api/rotations.js.map +1 -0
  127. package/cjs/api/sizes.d.ts +53 -0
  128. package/cjs/api/sizes.d.ts.map +1 -0
  129. package/cjs/api/sizes.js +56 -0
  130. package/cjs/api/sizes.js.map +1 -0
  131. package/cjs/api/svgPath.d.ts +3 -0
  132. package/cjs/api/svgPath.d.ts.map +1 -0
  133. package/cjs/api/svgPath.js +380 -0
  134. package/cjs/api/svgPath.js.map +1 -0
  135. package/cjs/api/text/alignment.d.ts +6 -0
  136. package/cjs/api/text/alignment.d.ts.map +1 -0
  137. package/cjs/api/text/alignment.js +10 -0
  138. package/cjs/api/text/alignment.js.map +1 -0
  139. package/cjs/api/text/index.d.ts +3 -0
  140. package/cjs/api/text/index.d.ts.map +1 -0
  141. package/cjs/api/text/index.js +6 -0
  142. package/cjs/api/text/index.js.map +1 -0
  143. package/cjs/api/text/layout.d.ts +55 -0
  144. package/cjs/api/text/layout.d.ts.map +1 -0
  145. package/cjs/api/text/layout.js +212 -0
  146. package/cjs/api/text/layout.js.map +1 -0
  147. package/cjs/core/PDFContext.d.ts +84 -0
  148. package/cjs/core/PDFContext.d.ts.map +1 -0
  149. package/cjs/core/PDFContext.js +201 -0
  150. package/cjs/core/PDFContext.js.map +1 -0
  151. package/cjs/core/PDFObjectCopier.d.ts +38 -0
  152. package/cjs/core/PDFObjectCopier.d.ts.map +1 -0
  153. package/cjs/core/PDFObjectCopier.js +119 -0
  154. package/cjs/core/PDFObjectCopier.js.map +1 -0
  155. package/cjs/core/acroform/PDFAcroButton.d.ts +22 -0
  156. package/cjs/core/acroform/PDFAcroButton.d.ts.map +1 -0
  157. package/cjs/core/acroform/PDFAcroButton.js +96 -0
  158. package/cjs/core/acroform/PDFAcroButton.js.map +1 -0
  159. package/cjs/core/acroform/PDFAcroCheckBox.d.ts +14 -0
  160. package/cjs/core/acroform/PDFAcroCheckBox.d.ts.map +1 -0
  161. package/cjs/core/acroform/PDFAcroCheckBox.js +50 -0
  162. package/cjs/core/acroform/PDFAcroCheckBox.js.map +1 -0
  163. package/cjs/core/acroform/PDFAcroChoice.d.ts +21 -0
  164. package/cjs/core/acroform/PDFAcroChoice.d.ts.map +1 -0
  165. package/cjs/core/acroform/PDFAcroChoice.js +127 -0
  166. package/cjs/core/acroform/PDFAcroChoice.js.map +1 -0
  167. package/cjs/core/acroform/PDFAcroComboBox.d.ts +10 -0
  168. package/cjs/core/acroform/PDFAcroComboBox.d.ts.map +1 -0
  169. package/cjs/core/acroform/PDFAcroComboBox.js +26 -0
  170. package/cjs/core/acroform/PDFAcroComboBox.js.map +1 -0
  171. package/cjs/core/acroform/PDFAcroField.d.ts +37 -0
  172. package/cjs/core/acroform/PDFAcroField.d.ts.map +1 -0
  173. package/cjs/core/acroform/PDFAcroField.js +149 -0
  174. package/cjs/core/acroform/PDFAcroField.js.map +1 -0
  175. package/cjs/core/acroform/PDFAcroForm.d.ts +21 -0
  176. package/cjs/core/acroform/PDFAcroForm.d.ts.map +1 -0
  177. package/cjs/core/acroform/PDFAcroForm.js +78 -0
  178. package/cjs/core/acroform/PDFAcroForm.js.map +1 -0
  179. package/cjs/core/acroform/PDFAcroListBox.d.ts +10 -0
  180. package/cjs/core/acroform/PDFAcroListBox.d.ts.map +1 -0
  181. package/cjs/core/acroform/PDFAcroListBox.js +24 -0
  182. package/cjs/core/acroform/PDFAcroListBox.js.map +1 -0
  183. package/cjs/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
  184. package/cjs/core/acroform/PDFAcroNonTerminal.d.ts.map +1 -0
  185. package/cjs/core/acroform/PDFAcroNonTerminal.js +34 -0
  186. package/cjs/core/acroform/PDFAcroNonTerminal.js.map +1 -0
  187. package/cjs/core/acroform/PDFAcroPushButton.d.ts +10 -0
  188. package/cjs/core/acroform/PDFAcroPushButton.d.ts.map +1 -0
  189. package/cjs/core/acroform/PDFAcroPushButton.js +26 -0
  190. package/cjs/core/acroform/PDFAcroPushButton.js.map +1 -0
  191. package/cjs/core/acroform/PDFAcroRadioButton.d.ts +14 -0
  192. package/cjs/core/acroform/PDFAcroRadioButton.d.ts.map +1 -0
  193. package/cjs/core/acroform/PDFAcroRadioButton.js +57 -0
  194. package/cjs/core/acroform/PDFAcroRadioButton.js.map +1 -0
  195. package/cjs/core/acroform/PDFAcroSignature.d.ts +8 -0
  196. package/cjs/core/acroform/PDFAcroSignature.d.ts.map +1 -0
  197. package/cjs/core/acroform/PDFAcroSignature.js +16 -0
  198. package/cjs/core/acroform/PDFAcroSignature.js.map +1 -0
  199. package/cjs/core/acroform/PDFAcroTerminal.d.ts +17 -0
  200. package/cjs/core/acroform/PDFAcroTerminal.d.ts.map +1 -0
  201. package/cjs/core/acroform/PDFAcroTerminal.js +70 -0
  202. package/cjs/core/acroform/PDFAcroTerminal.js.map +1 -0
  203. package/cjs/core/acroform/PDFAcroText.d.ts +23 -0
  204. package/cjs/core/acroform/PDFAcroText.d.ts.map +1 -0
  205. package/cjs/core/acroform/PDFAcroText.js +73 -0
  206. package/cjs/core/acroform/PDFAcroText.js.map +1 -0
  207. package/cjs/core/acroform/flags.d.ts +142 -0
  208. package/cjs/core/acroform/flags.d.ts.map +1 -0
  209. package/cjs/core/acroform/flags.js +150 -0
  210. package/cjs/core/acroform/flags.js.map +1 -0
  211. package/cjs/core/acroform/index.d.ts +16 -0
  212. package/cjs/core/acroform/index.d.ts.map +1 -0
  213. package/cjs/core/acroform/index.js +32 -0
  214. package/cjs/core/acroform/index.js.map +1 -0
  215. package/cjs/core/acroform/utils.d.ts +7 -0
  216. package/cjs/core/acroform/utils.d.ts.map +1 -0
  217. package/cjs/core/acroform/utils.js +127 -0
  218. package/cjs/core/acroform/utils.js.map +1 -0
  219. package/cjs/core/annotation/AppearanceCharacteristics.d.ts +34 -0
  220. package/cjs/core/annotation/AppearanceCharacteristics.d.ts.map +1 -0
  221. package/cjs/core/annotation/AppearanceCharacteristics.js +123 -0
  222. package/cjs/core/annotation/AppearanceCharacteristics.js.map +1 -0
  223. package/cjs/core/annotation/BorderStyle.d.ts +12 -0
  224. package/cjs/core/annotation/BorderStyle.d.ts.map +1 -0
  225. package/cjs/core/annotation/BorderStyle.js +29 -0
  226. package/cjs/core/annotation/BorderStyle.js.map +1 -0
  227. package/cjs/core/annotation/PDFAnnotation.d.ts +52 -0
  228. package/cjs/core/annotation/PDFAnnotation.d.ts.map +1 -0
  229. package/cjs/core/annotation/PDFAnnotation.js +123 -0
  230. package/cjs/core/annotation/PDFAnnotation.js.map +1 -0
  231. package/cjs/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
  232. package/cjs/core/annotation/PDFWidgetAnnotation.d.ts.map +1 -0
  233. package/cjs/core/annotation/PDFWidgetAnnotation.js +110 -0
  234. package/cjs/core/annotation/PDFWidgetAnnotation.js.map +1 -0
  235. package/cjs/core/annotation/flags.d.ts +80 -0
  236. package/cjs/core/annotation/flags.d.ts.map +1 -0
  237. package/cjs/core/annotation/flags.js +85 -0
  238. package/cjs/core/annotation/flags.js.map +1 -0
  239. package/cjs/core/annotation/index.d.ts +5 -0
  240. package/cjs/core/annotation/index.d.ts.map +1 -0
  241. package/cjs/core/annotation/index.js +11 -0
  242. package/cjs/core/annotation/index.js.map +1 -0
  243. package/cjs/core/document/PDFCrossRefSection.d.ts +28 -0
  244. package/cjs/core/document/PDFCrossRefSection.d.ts.map +1 -0
  245. package/cjs/core/document/PDFCrossRefSection.js +124 -0
  246. package/cjs/core/document/PDFCrossRefSection.js.map +1 -0
  247. package/cjs/core/document/PDFHeader.d.ts +11 -0
  248. package/cjs/core/document/PDFHeader.d.ts.map +1 -0
  249. package/cjs/core/document/PDFHeader.js +42 -0
  250. package/cjs/core/document/PDFHeader.js.map +1 -0
  251. package/cjs/core/document/PDFTrailer.d.ts +10 -0
  252. package/cjs/core/document/PDFTrailer.d.ts.map +1 -0
  253. package/cjs/core/document/PDFTrailer.js +43 -0
  254. package/cjs/core/document/PDFTrailer.js.map +1 -0
  255. package/cjs/core/document/PDFTrailerDict.d.ts +11 -0
  256. package/cjs/core/document/PDFTrailerDict.d.ts.map +1 -0
  257. package/cjs/core/document/PDFTrailerDict.js +32 -0
  258. package/cjs/core/document/PDFTrailerDict.js.map +1 -0
  259. package/cjs/core/embedders/CMap.d.ts +4 -0
  260. package/cjs/core/embedders/CMap.d.ts.map +1 -0
  261. package/cjs/core/embedders/CMap.js +43 -0
  262. package/cjs/core/embedders/CMap.js.map +1 -0
  263. package/cjs/core/embedders/CustomFontEmbedder.d.ts +45 -0
  264. package/cjs/core/embedders/CustomFontEmbedder.d.ts.map +1 -0
  265. package/cjs/core/embedders/CustomFontEmbedder.js +240 -0
  266. package/cjs/core/embedders/CustomFontEmbedder.js.map +1 -0
  267. package/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
  268. package/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts.map +1 -0
  269. package/cjs/core/embedders/CustomFontSubsetEmbedder.js +81 -0
  270. package/cjs/core/embedders/CustomFontSubsetEmbedder.js.map +1 -0
  271. package/cjs/core/embedders/FileEmbedder.d.ts +34 -0
  272. package/cjs/core/embedders/FileEmbedder.d.ts.map +1 -0
  273. package/cjs/core/embedders/FileEmbedder.js +75 -0
  274. package/cjs/core/embedders/FileEmbedder.js.map +1 -0
  275. package/cjs/core/embedders/FontFlags.d.ts +14 -0
  276. package/cjs/core/embedders/FontFlags.d.ts.map +1 -0
  277. package/cjs/core/embedders/FontFlags.js +40 -0
  278. package/cjs/core/embedders/FontFlags.js.map +1 -0
  279. package/cjs/core/embedders/JavaScriptEmbedder.d.ts +11 -0
  280. package/cjs/core/embedders/JavaScriptEmbedder.d.ts.map +1 -0
  281. package/cjs/core/embedders/JavaScriptEmbedder.js +36 -0
  282. package/cjs/core/embedders/JavaScriptEmbedder.js.map +1 -0
  283. package/cjs/core/embedders/JpegEmbedder.d.ts +24 -0
  284. package/cjs/core/embedders/JpegEmbedder.d.ts.map +1 -0
  285. package/cjs/core/embedders/JpegEmbedder.js +107 -0
  286. package/cjs/core/embedders/JpegEmbedder.js.map +1 -0
  287. package/cjs/core/embedders/PDFPageEmbedder.d.ts +38 -0
  288. package/cjs/core/embedders/PDFPageEmbedder.d.ts.map +1 -0
  289. package/cjs/core/embedders/PDFPageEmbedder.js +91 -0
  290. package/cjs/core/embedders/PDFPageEmbedder.js.map +1 -0
  291. package/cjs/core/embedders/PngEmbedder.d.ts +20 -0
  292. package/cjs/core/embedders/PngEmbedder.d.ts.map +1 -0
  293. package/cjs/core/embedders/PngEmbedder.js +69 -0
  294. package/cjs/core/embedders/PngEmbedder.js.map +1 -0
  295. package/cjs/core/embedders/StandardFontEmbedder.d.ts +37 -0
  296. package/cjs/core/embedders/StandardFontEmbedder.d.ts.map +1 -0
  297. package/cjs/core/embedders/StandardFontEmbedder.js +98 -0
  298. package/cjs/core/embedders/StandardFontEmbedder.js.map +1 -0
  299. package/cjs/core/errors.d.ts +92 -0
  300. package/cjs/core/errors.d.ts.map +1 -0
  301. package/cjs/core/errors.js +323 -0
  302. package/cjs/core/errors.js.map +1 -0
  303. package/cjs/core/index.d.ts +48 -0
  304. package/cjs/core/index.d.ts.map +1 -0
  305. package/cjs/core/index.js +100 -0
  306. package/cjs/core/index.js.map +1 -0
  307. package/cjs/core/interactive/ViewerPreferences.d.ts +348 -0
  308. package/cjs/core/interactive/ViewerPreferences.d.ts.map +1 -0
  309. package/cjs/core/interactive/ViewerPreferences.js +511 -0
  310. package/cjs/core/interactive/ViewerPreferences.js.map +1 -0
  311. package/cjs/core/objects/PDFArray.d.ts +64 -0
  312. package/cjs/core/objects/PDFArray.d.ts.map +1 -0
  313. package/cjs/core/objects/PDFArray.js +117 -0
  314. package/cjs/core/objects/PDFArray.js.map +1 -0
  315. package/cjs/core/objects/PDFBool.d.ts +14 -0
  316. package/cjs/core/objects/PDFBool.d.ts.map +1 -0
  317. package/cjs/core/objects/PDFBool.js +52 -0
  318. package/cjs/core/objects/PDFBool.js.map +1 -0
  319. package/cjs/core/objects/PDFDict.d.ts +62 -0
  320. package/cjs/core/objects/PDFDict.d.ts.map +1 -0
  321. package/cjs/core/objects/PDFDict.js +138 -0
  322. package/cjs/core/objects/PDFDict.js.map +1 -0
  323. package/cjs/core/objects/PDFHexString.d.ts +17 -0
  324. package/cjs/core/objects/PDFHexString.d.ts.map +1 -0
  325. package/cjs/core/objects/PDFHexString.js +74 -0
  326. package/cjs/core/objects/PDFHexString.js.map +1 -0
  327. package/cjs/core/objects/PDFInvalidObject.d.ts +12 -0
  328. package/cjs/core/objects/PDFInvalidObject.d.ts.map +1 -0
  329. package/cjs/core/objects/PDFInvalidObject.js +32 -0
  330. package/cjs/core/objects/PDFInvalidObject.js.map +1 -0
  331. package/cjs/core/objects/PDFName.d.ts +42 -0
  332. package/cjs/core/objects/PDFName.d.ts.map +1 -0
  333. package/cjs/core/objects/PDFName.js +138 -0
  334. package/cjs/core/objects/PDFName.js.map +1 -0
  335. package/cjs/core/objects/PDFNull.d.ts +11 -0
  336. package/cjs/core/objects/PDFNull.d.ts.map +1 -0
  337. package/cjs/core/objects/PDFNull.js +33 -0
  338. package/cjs/core/objects/PDFNull.js.map +1 -0
  339. package/cjs/core/objects/PDFNumber.d.ts +16 -0
  340. package/cjs/core/objects/PDFNumber.d.ts.map +1 -0
  341. package/cjs/core/objects/PDFNumber.js +38 -0
  342. package/cjs/core/objects/PDFNumber.js.map +1 -0
  343. package/cjs/core/objects/PDFObject.d.ts +9 -0
  344. package/cjs/core/objects/PDFObject.d.ts.map +1 -0
  345. package/cjs/core/objects/PDFObject.js +22 -0
  346. package/cjs/core/objects/PDFObject.js.map +1 -0
  347. package/cjs/core/objects/PDFRawStream.d.ts +15 -0
  348. package/cjs/core/objects/PDFRawStream.d.ts.map +1 -0
  349. package/cjs/core/objects/PDFRawStream.js +34 -0
  350. package/cjs/core/objects/PDFRawStream.js.map +1 -0
  351. package/cjs/core/objects/PDFRef.d.ts +14 -0
  352. package/cjs/core/objects/PDFRef.d.ts.map +1 -0
  353. package/cjs/core/objects/PDFRef.js +47 -0
  354. package/cjs/core/objects/PDFRef.js.map +1 -0
  355. package/cjs/core/objects/PDFStream.d.ts +17 -0
  356. package/cjs/core/objects/PDFStream.d.ts.map +1 -0
  357. package/cjs/core/objects/PDFStream.js +75 -0
  358. package/cjs/core/objects/PDFStream.js.map +1 -0
  359. package/cjs/core/objects/PDFString.d.ts +17 -0
  360. package/cjs/core/objects/PDFString.d.ts.map +1 -0
  361. package/cjs/core/objects/PDFString.js +116 -0
  362. package/cjs/core/objects/PDFString.js.map +1 -0
  363. package/cjs/core/operators/PDFOperator.d.ts +20 -0
  364. package/cjs/core/operators/PDFOperator.d.ts.map +1 -0
  365. package/cjs/core/operators/PDFOperator.js +58 -0
  366. package/cjs/core/operators/PDFOperator.js.map +1 -0
  367. package/cjs/core/operators/PDFOperatorNames.d.ts +77 -0
  368. package/cjs/core/operators/PDFOperatorNames.d.ts.map +1 -0
  369. package/cjs/core/operators/PDFOperatorNames.js +88 -0
  370. package/cjs/core/operators/PDFOperatorNames.js.map +1 -0
  371. package/cjs/core/parser/BaseParser.d.ts +15 -0
  372. package/cjs/core/parser/BaseParser.d.ts.map +1 -0
  373. package/cjs/core/parser/BaseParser.js +110 -0
  374. package/cjs/core/parser/BaseParser.js.map +1 -0
  375. package/cjs/core/parser/ByteStream.d.ts +27 -0
  376. package/cjs/core/parser/ByteStream.d.ts.map +1 -0
  377. package/cjs/core/parser/ByteStream.js +64 -0
  378. package/cjs/core/parser/ByteStream.js.map +1 -0
  379. package/cjs/core/parser/PDFObjectParser.d.ts +30 -0
  380. package/cjs/core/parser/PDFObjectParser.d.ts.map +1 -0
  381. package/cjs/core/parser/PDFObjectParser.js +233 -0
  382. package/cjs/core/parser/PDFObjectParser.js.map +1 -0
  383. package/cjs/core/parser/PDFObjectStreamParser.d.ts +14 -0
  384. package/cjs/core/parser/PDFObjectStreamParser.d.ts.map +1 -0
  385. package/cjs/core/parser/PDFObjectStreamParser.js +70 -0
  386. package/cjs/core/parser/PDFObjectStreamParser.js.map +1 -0
  387. package/cjs/core/parser/PDFParser.d.ts +46 -0
  388. package/cjs/core/parser/PDFParser.d.ts.map +1 -0
  389. package/cjs/core/parser/PDFParser.js +356 -0
  390. package/cjs/core/parser/PDFParser.js.map +1 -0
  391. package/cjs/core/parser/PDFXRefStreamParser.d.ts +22 -0
  392. package/cjs/core/parser/PDFXRefStreamParser.d.ts.map +1 -0
  393. package/cjs/core/parser/PDFXRefStreamParser.js +92 -0
  394. package/cjs/core/parser/PDFXRefStreamParser.js.map +1 -0
  395. package/cjs/core/streams/Ascii85Stream.d.ts +10 -0
  396. package/cjs/core/streams/Ascii85Stream.d.ts.map +1 -0
  397. package/cjs/core/streams/Ascii85Stream.js +87 -0
  398. package/cjs/core/streams/Ascii85Stream.js.map +1 -0
  399. package/cjs/core/streams/AsciiHexStream.d.ts +10 -0
  400. package/cjs/core/streams/AsciiHexStream.d.ts.map +1 -0
  401. package/cjs/core/streams/AsciiHexStream.js +75 -0
  402. package/cjs/core/streams/AsciiHexStream.js.map +1 -0
  403. package/cjs/core/streams/DecodeStream.d.ts +27 -0
  404. package/cjs/core/streams/DecodeStream.d.ts.map +1 -0
  405. package/cjs/core/streams/DecodeStream.js +149 -0
  406. package/cjs/core/streams/DecodeStream.js.map +1 -0
  407. package/cjs/core/streams/FlateStream.d.ts +14 -0
  408. package/cjs/core/streams/FlateStream.d.ts.map +1 -0
  409. package/cjs/core/streams/FlateStream.js +371 -0
  410. package/cjs/core/streams/FlateStream.js.map +1 -0
  411. package/cjs/core/streams/LZWStream.d.ts +13 -0
  412. package/cjs/core/streams/LZWStream.d.ts.map +1 -0
  413. package/cjs/core/streams/LZWStream.js +137 -0
  414. package/cjs/core/streams/LZWStream.js.map +1 -0
  415. package/cjs/core/streams/RunLengthStream.d.ts +9 -0
  416. package/cjs/core/streams/RunLengthStream.d.ts.map +1 -0
  417. package/cjs/core/streams/RunLengthStream.js +55 -0
  418. package/cjs/core/streams/RunLengthStream.js.map +1 -0
  419. package/cjs/core/streams/Stream.d.ts +35 -0
  420. package/cjs/core/streams/Stream.d.ts.map +1 -0
  421. package/cjs/core/streams/Stream.js +106 -0
  422. package/cjs/core/streams/Stream.js.map +1 -0
  423. package/cjs/core/streams/decode.d.ts +4 -0
  424. package/cjs/core/streams/decode.d.ts.map +1 -0
  425. package/cjs/core/streams/decode.js +59 -0
  426. package/cjs/core/streams/decode.js.map +1 -0
  427. package/cjs/core/structures/PDFCatalog.d.ts +28 -0
  428. package/cjs/core/structures/PDFCatalog.d.ts.map +1 -0
  429. package/cjs/core/structures/PDFCatalog.js +79 -0
  430. package/cjs/core/structures/PDFCatalog.js.map +1 -0
  431. package/cjs/core/structures/PDFContentStream.d.ts +16 -0
  432. package/cjs/core/structures/PDFContentStream.d.ts.map +1 -0
  433. package/cjs/core/structures/PDFContentStream.js +60 -0
  434. package/cjs/core/structures/PDFContentStream.js.map +1 -0
  435. package/cjs/core/structures/PDFCrossRefStream.d.ts +54 -0
  436. package/cjs/core/structures/PDFCrossRefStream.d.ts.map +1 -0
  437. package/cjs/core/structures/PDFCrossRefStream.js +187 -0
  438. package/cjs/core/structures/PDFCrossRefStream.js.map +1 -0
  439. package/cjs/core/structures/PDFFlateStream.d.ts +14 -0
  440. package/cjs/core/structures/PDFFlateStream.d.ts.map +1 -0
  441. package/cjs/core/structures/PDFFlateStream.js +35 -0
  442. package/cjs/core/structures/PDFFlateStream.js.map +1 -0
  443. package/cjs/core/structures/PDFObjectStream.d.ts +21 -0
  444. package/cjs/core/structures/PDFObjectStream.d.ts.map +1 -0
  445. package/cjs/core/structures/PDFObjectStream.js +77 -0
  446. package/cjs/core/structures/PDFObjectStream.js.map +1 -0
  447. package/cjs/core/structures/PDFPageLeaf.d.ts +55 -0
  448. package/cjs/core/structures/PDFPageLeaf.d.ts.map +1 -0
  449. package/cjs/core/structures/PDFPageLeaf.js +206 -0
  450. package/cjs/core/structures/PDFPageLeaf.js.map +1 -0
  451. package/cjs/core/structures/PDFPageTree.d.ts +42 -0
  452. package/cjs/core/structures/PDFPageTree.d.ts.map +1 -0
  453. package/cjs/core/structures/PDFPageTree.js +177 -0
  454. package/cjs/core/structures/PDFPageTree.js.map +1 -0
  455. package/cjs/core/syntax/CharCodes.d.ts +62 -0
  456. package/cjs/core/syntax/CharCodes.d.ts.map +1 -0
  457. package/cjs/core/syntax/CharCodes.js +65 -0
  458. package/cjs/core/syntax/CharCodes.js.map +1 -0
  459. package/cjs/core/syntax/Delimiters.d.ts +2 -0
  460. package/cjs/core/syntax/Delimiters.d.ts.map +1 -0
  461. package/cjs/core/syntax/Delimiters.js +17 -0
  462. package/cjs/core/syntax/Delimiters.js.map +1 -0
  463. package/cjs/core/syntax/Irregular.d.ts +2 -0
  464. package/cjs/core/syntax/Irregular.d.ts.map +1 -0
  465. package/cjs/core/syntax/Irregular.js +13 -0
  466. package/cjs/core/syntax/Irregular.js.map +1 -0
  467. package/cjs/core/syntax/Keywords.d.ts +23 -0
  468. package/cjs/core/syntax/Keywords.d.ts.map +1 -0
  469. package/cjs/core/syntax/Keywords.js +84 -0
  470. package/cjs/core/syntax/Keywords.js.map +1 -0
  471. package/cjs/core/syntax/Numeric.d.ts +4 -0
  472. package/cjs/core/syntax/Numeric.d.ts.map +1 -0
  473. package/cjs/core/syntax/Numeric.js +25 -0
  474. package/cjs/core/syntax/Numeric.js.map +1 -0
  475. package/cjs/core/syntax/Whitespace.d.ts +2 -0
  476. package/cjs/core/syntax/Whitespace.d.ts.map +1 -0
  477. package/cjs/core/syntax/Whitespace.js +13 -0
  478. package/cjs/core/syntax/Whitespace.js.map +1 -0
  479. package/cjs/core/writers/PDFStreamWriter.d.ts +20 -0
  480. package/cjs/core/writers/PDFStreamWriter.d.ts.map +1 -0
  481. package/cjs/core/writers/PDFStreamWriter.js +113 -0
  482. package/cjs/core/writers/PDFStreamWriter.js.map +1 -0
  483. package/cjs/core/writers/PDFWriter.d.ts +30 -0
  484. package/cjs/core/writers/PDFWriter.d.ts.map +1 -0
  485. package/cjs/core/writers/PDFWriter.js +144 -0
  486. package/cjs/core/writers/PDFWriter.js.map +1 -0
  487. package/cjs/index.d.ts +5 -0
  488. package/cjs/index.d.ts.map +1 -0
  489. package/cjs/index.js +8 -0
  490. package/cjs/index.js.map +1 -0
  491. package/cjs/types/fontkit.d.ts +598 -0
  492. package/cjs/types/fontkit.d.ts.map +1 -0
  493. package/cjs/types/fontkit.js +3 -0
  494. package/cjs/types/fontkit.js.map +1 -0
  495. package/cjs/types/index.d.ts +2 -0
  496. package/cjs/types/index.d.ts.map +1 -0
  497. package/cjs/types/index.js +3 -0
  498. package/cjs/types/index.js.map +1 -0
  499. package/cjs/types/matrix.d.ts +22 -0
  500. package/cjs/types/matrix.d.ts.map +1 -0
  501. package/cjs/types/matrix.js +5 -0
  502. package/cjs/types/matrix.js.map +1 -0
  503. package/cjs/utils/Cache.d.ts +11 -0
  504. package/cjs/utils/Cache.d.ts.map +1 -0
  505. package/cjs/utils/Cache.js +23 -0
  506. package/cjs/utils/Cache.js.map +1 -0
  507. package/cjs/utils/arrays.d.ts +16 -0
  508. package/cjs/utils/arrays.d.ts.map +1 -0
  509. package/cjs/utils/arrays.js +132 -0
  510. package/cjs/utils/arrays.js.map +1 -0
  511. package/cjs/utils/async.d.ts +6 -0
  512. package/cjs/utils/async.d.ts.map +1 -0
  513. package/cjs/utils/async.js +13 -0
  514. package/cjs/utils/async.js.map +1 -0
  515. package/cjs/utils/base64.d.ts +11 -0
  516. package/cjs/utils/base64.d.ts.map +1 -0
  517. package/cjs/utils/base64.js +87 -0
  518. package/cjs/utils/base64.js.map +1 -0
  519. package/cjs/utils/errors.d.ts +2 -0
  520. package/cjs/utils/errors.d.ts.map +1 -0
  521. package/cjs/utils/errors.js +7 -0
  522. package/cjs/utils/errors.js.map +1 -0
  523. package/cjs/utils/index.d.ts +12 -0
  524. package/cjs/utils/index.d.ts.map +1 -0
  525. package/cjs/utils/index.js +16 -0
  526. package/cjs/utils/index.js.map +1 -0
  527. package/cjs/utils/numbers.d.ts +24 -0
  528. package/cjs/utils/numbers.d.ts.map +1 -0
  529. package/cjs/utils/numbers.js +57 -0
  530. package/cjs/utils/numbers.js.map +1 -0
  531. package/cjs/utils/objects.d.ts +16 -0
  532. package/cjs/utils/objects.d.ts.map +1 -0
  533. package/cjs/utils/objects.js +11 -0
  534. package/cjs/utils/objects.js.map +1 -0
  535. package/cjs/utils/pdfDocEncoding.d.ts +8 -0
  536. package/cjs/utils/pdfDocEncoding.d.ts.map +1 -0
  537. package/cjs/utils/pdfDocEncoding.js +69 -0
  538. package/cjs/utils/pdfDocEncoding.js.map +1 -0
  539. package/cjs/utils/png.d.ts +18 -0
  540. package/cjs/utils/png.d.ts.map +1 -0
  541. package/cjs/utils/png.js +63 -0
  542. package/cjs/utils/png.js.map +1 -0
  543. package/cjs/utils/rng.d.ts +14 -0
  544. package/cjs/utils/rng.d.ts.map +1 -0
  545. package/cjs/utils/rng.js +23 -0
  546. package/cjs/utils/rng.js.map +1 -0
  547. package/cjs/utils/strings.d.ts +25 -0
  548. package/cjs/utils/strings.d.ts.map +1 -0
  549. package/cjs/utils/strings.js +141 -0
  550. package/cjs/utils/strings.js.map +1 -0
  551. package/cjs/utils/unicode.d.ts +187 -0
  552. package/cjs/utils/unicode.d.ts.map +1 -0
  553. package/cjs/utils/unicode.js +370 -0
  554. package/cjs/utils/unicode.js.map +1 -0
  555. package/cjs/utils/validators.d.ts +27 -0
  556. package/cjs/utils/validators.d.ts.map +1 -0
  557. package/cjs/utils/validators.js +183 -0
  558. package/cjs/utils/validators.js.map +1 -0
  559. package/dist/pdf-lib.esm.js +39417 -0
  560. package/dist/pdf-lib.esm.js.map +1 -0
  561. package/dist/pdf-lib.esm.min.js +16 -0
  562. package/dist/pdf-lib.esm.min.js.map +1 -0
  563. package/dist/pdf-lib.js +39687 -0
  564. package/dist/pdf-lib.js.map +1 -0
  565. package/dist/pdf-lib.min.js +16 -0
  566. package/dist/pdf-lib.min.js.map +1 -0
  567. package/es/api/Embeddable.d.ts +8 -0
  568. package/es/api/Embeddable.d.ts.map +1 -0
  569. package/es/api/Embeddable.js +1 -0
  570. package/es/api/Embeddable.js.map +1 -0
  571. package/es/api/PDFDocument.d.ts +779 -0
  572. package/es/api/PDFDocument.d.ts.map +1 -0
  573. package/es/api/PDFDocument.js +1367 -0
  574. package/es/api/PDFDocument.js.map +1 -0
  575. package/es/api/PDFDocumentOptions.d.ts +38 -0
  576. package/es/api/PDFDocumentOptions.d.ts.map +1 -0
  577. package/es/api/PDFDocumentOptions.js +8 -0
  578. package/es/api/PDFDocumentOptions.js.map +1 -0
  579. package/es/api/PDFEmbeddedFile.d.ts +39 -0
  580. package/es/api/PDFEmbeddedFile.d.ts.map +1 -0
  581. package/es/api/PDFEmbeddedFile.js +82 -0
  582. package/es/api/PDFEmbeddedFile.js.map +1 -0
  583. package/es/api/PDFEmbeddedPage.d.ts +74 -0
  584. package/es/api/PDFEmbeddedPage.d.ts.map +1 -0
  585. package/es/api/PDFEmbeddedPage.js +93 -0
  586. package/es/api/PDFEmbeddedPage.js.map +1 -0
  587. package/es/api/PDFFont.d.ts +95 -0
  588. package/es/api/PDFFont.d.ts.map +1 -0
  589. package/es/api/PDFFont.js +141 -0
  590. package/es/api/PDFFont.js.map +1 -0
  591. package/es/api/PDFImage.d.ts +96 -0
  592. package/es/api/PDFImage.d.ts.map +1 -0
  593. package/es/api/PDFImage.js +130 -0
  594. package/es/api/PDFImage.js.map +1 -0
  595. package/es/api/PDFJavaScript.d.ts +39 -0
  596. package/es/api/PDFJavaScript.d.ts.map +1 -0
  597. package/es/api/PDFJavaScript.js +71 -0
  598. package/es/api/PDFJavaScript.js.map +1 -0
  599. package/es/api/PDFPage.d.ts +898 -0
  600. package/es/api/PDFPage.d.ts.map +1 -0
  601. package/es/api/PDFPage.js +1440 -0
  602. package/es/api/PDFPage.js.map +1 -0
  603. package/es/api/PDFPageOptions.d.ts +155 -0
  604. package/es/api/PDFPageOptions.d.ts.map +1 -0
  605. package/es/api/PDFPageOptions.js +16 -0
  606. package/es/api/PDFPageOptions.js.map +1 -0
  607. package/es/api/StandardFonts.d.ts +17 -0
  608. package/es/api/StandardFonts.d.ts.map +1 -0
  609. package/es/api/StandardFonts.js +18 -0
  610. package/es/api/StandardFonts.js.map +1 -0
  611. package/es/api/colors.d.ts +31 -0
  612. package/es/api/colors.d.ts.map +1 -0
  613. package/es/api/colors.js +56 -0
  614. package/es/api/colors.js.map +1 -0
  615. package/es/api/errors.d.ts +43 -0
  616. package/es/api/errors.d.ts.map +1 -0
  617. package/es/api/errors.js +165 -0
  618. package/es/api/errors.js.map +1 -0
  619. package/es/api/form/PDFButton.d.ts +138 -0
  620. package/es/api/form/PDFButton.d.ts.map +1 -0
  621. package/es/api/form/PDFButton.js +218 -0
  622. package/es/api/form/PDFButton.js.map +1 -0
  623. package/es/api/form/PDFCheckBox.d.ts +143 -0
  624. package/es/api/form/PDFCheckBox.d.ts.map +1 -0
  625. package/es/api/form/PDFCheckBox.js +234 -0
  626. package/es/api/form/PDFCheckBox.js.map +1 -0
  627. package/es/api/form/PDFDropdown.d.ts +403 -0
  628. package/es/api/form/PDFDropdown.d.ts.map +1 -0
  629. package/es/api/form/PDFDropdown.js +578 -0
  630. package/es/api/form/PDFDropdown.js.map +1 -0
  631. package/es/api/form/PDFField.d.ts +204 -0
  632. package/es/api/form/PDFField.d.ts.map +1 -0
  633. package/es/api/form/PDFField.js +381 -0
  634. package/es/api/form/PDFField.js.map +1 -0
  635. package/es/api/form/PDFForm.d.ts +412 -0
  636. package/es/api/form/PDFForm.d.ts.map +1 -0
  637. package/es/api/form/PDFForm.js +724 -0
  638. package/es/api/form/PDFForm.js.map +1 -0
  639. package/es/api/form/PDFOptionList.d.ts +336 -0
  640. package/es/api/form/PDFOptionList.d.ts.map +1 -0
  641. package/es/api/form/PDFOptionList.js +497 -0
  642. package/es/api/form/PDFOptionList.js.map +1 -0
  643. package/es/api/form/PDFRadioGroup.d.ts +253 -0
  644. package/es/api/form/PDFRadioGroup.d.ts.map +1 -0
  645. package/es/api/form/PDFRadioGroup.js +413 -0
  646. package/es/api/form/PDFRadioGroup.js.map +1 -0
  647. package/es/api/form/PDFSignature.d.ts +30 -0
  648. package/es/api/form/PDFSignature.d.ts.map +1 -0
  649. package/es/api/form/PDFSignature.js +41 -0
  650. package/es/api/form/PDFSignature.js.map +1 -0
  651. package/es/api/form/PDFTextField.d.ts +538 -0
  652. package/es/api/form/PDFTextField.d.ts.map +1 -0
  653. package/es/api/form/PDFTextField.js +737 -0
  654. package/es/api/form/PDFTextField.js.map +1 -0
  655. package/es/api/form/appearances.d.ts +42 -0
  656. package/es/api/form/appearances.d.ts.map +1 -0
  657. package/es/api/form/appearances.js +418 -0
  658. package/es/api/form/appearances.js.map +1 -0
  659. package/es/api/form/index.d.ts +11 -0
  660. package/es/api/form/index.d.ts.map +1 -0
  661. package/es/api/form/index.js +11 -0
  662. package/es/api/form/index.js.map +1 -0
  663. package/es/api/image/alignment.d.ts +6 -0
  664. package/es/api/image/alignment.d.ts.map +1 -0
  665. package/es/api/image/alignment.js +7 -0
  666. package/es/api/image/alignment.js.map +1 -0
  667. package/es/api/image/index.d.ts +2 -0
  668. package/es/api/image/index.d.ts.map +1 -0
  669. package/es/api/image/index.js +2 -0
  670. package/es/api/image/index.js.map +1 -0
  671. package/es/api/index.d.ts +21 -0
  672. package/es/api/index.d.ts.map +1 -0
  673. package/es/api/index.js +20 -0
  674. package/es/api/index.js.map +1 -0
  675. package/es/api/objects.d.ts +5 -0
  676. package/es/api/objects.d.ts.map +1 -0
  677. package/es/api/objects.js +11 -0
  678. package/es/api/objects.js.map +1 -0
  679. package/es/api/operations.d.ts +212 -0
  680. package/es/api/operations.d.ts.map +1 -0
  681. package/es/api/operations.js +485 -0
  682. package/es/api/operations.js.map +1 -0
  683. package/es/api/operators.d.ts +86 -0
  684. package/es/api/operators.d.ts.map +1 -0
  685. package/es/api/operators.js +228 -0
  686. package/es/api/operators.js.map +1 -0
  687. package/es/api/rotations.d.ts +39 -0
  688. package/es/api/rotations.d.ts.map +1 -0
  689. package/es/api/rotations.js +68 -0
  690. package/es/api/rotations.js.map +1 -0
  691. package/es/api/sizes.d.ts +53 -0
  692. package/es/api/sizes.d.ts.map +1 -0
  693. package/es/api/sizes.js +53 -0
  694. package/es/api/sizes.js.map +1 -0
  695. package/es/api/svgPath.d.ts +3 -0
  696. package/es/api/svgPath.d.ts.map +1 -0
  697. package/es/api/svgPath.js +377 -0
  698. package/es/api/svgPath.js.map +1 -0
  699. package/es/api/text/alignment.d.ts +6 -0
  700. package/es/api/text/alignment.d.ts.map +1 -0
  701. package/es/api/text/alignment.js +7 -0
  702. package/es/api/text/alignment.js.map +1 -0
  703. package/es/api/text/index.d.ts +3 -0
  704. package/es/api/text/index.d.ts.map +1 -0
  705. package/es/api/text/index.js +3 -0
  706. package/es/api/text/index.js.map +1 -0
  707. package/es/api/text/layout.d.ts +55 -0
  708. package/es/api/text/layout.d.ts.map +1 -0
  709. package/es/api/text/layout.js +209 -0
  710. package/es/api/text/layout.js.map +1 -0
  711. package/es/core/PDFContext.d.ts +84 -0
  712. package/es/core/PDFContext.d.ts.map +1 -0
  713. package/es/core/PDFContext.js +199 -0
  714. package/es/core/PDFContext.js.map +1 -0
  715. package/es/core/PDFObjectCopier.d.ts +38 -0
  716. package/es/core/PDFObjectCopier.d.ts.map +1 -0
  717. package/es/core/PDFObjectCopier.js +116 -0
  718. package/es/core/PDFObjectCopier.js.map +1 -0
  719. package/es/core/acroform/PDFAcroButton.d.ts +22 -0
  720. package/es/core/acroform/PDFAcroButton.d.ts.map +1 -0
  721. package/es/core/acroform/PDFAcroButton.js +94 -0
  722. package/es/core/acroform/PDFAcroButton.js.map +1 -0
  723. package/es/core/acroform/PDFAcroCheckBox.d.ts +14 -0
  724. package/es/core/acroform/PDFAcroCheckBox.d.ts.map +1 -0
  725. package/es/core/acroform/PDFAcroCheckBox.js +48 -0
  726. package/es/core/acroform/PDFAcroCheckBox.js.map +1 -0
  727. package/es/core/acroform/PDFAcroChoice.d.ts +21 -0
  728. package/es/core/acroform/PDFAcroChoice.d.ts.map +1 -0
  729. package/es/core/acroform/PDFAcroChoice.js +125 -0
  730. package/es/core/acroform/PDFAcroChoice.js.map +1 -0
  731. package/es/core/acroform/PDFAcroComboBox.d.ts +10 -0
  732. package/es/core/acroform/PDFAcroComboBox.d.ts.map +1 -0
  733. package/es/core/acroform/PDFAcroComboBox.js +24 -0
  734. package/es/core/acroform/PDFAcroComboBox.js.map +1 -0
  735. package/es/core/acroform/PDFAcroField.d.ts +37 -0
  736. package/es/core/acroform/PDFAcroField.d.ts.map +1 -0
  737. package/es/core/acroform/PDFAcroField.js +146 -0
  738. package/es/core/acroform/PDFAcroField.js.map +1 -0
  739. package/es/core/acroform/PDFAcroForm.d.ts +21 -0
  740. package/es/core/acroform/PDFAcroForm.d.ts.map +1 -0
  741. package/es/core/acroform/PDFAcroForm.js +75 -0
  742. package/es/core/acroform/PDFAcroForm.js.map +1 -0
  743. package/es/core/acroform/PDFAcroListBox.d.ts +10 -0
  744. package/es/core/acroform/PDFAcroListBox.d.ts.map +1 -0
  745. package/es/core/acroform/PDFAcroListBox.js +22 -0
  746. package/es/core/acroform/PDFAcroListBox.js.map +1 -0
  747. package/es/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
  748. package/es/core/acroform/PDFAcroNonTerminal.d.ts.map +1 -0
  749. package/es/core/acroform/PDFAcroNonTerminal.js +32 -0
  750. package/es/core/acroform/PDFAcroNonTerminal.js.map +1 -0
  751. package/es/core/acroform/PDFAcroPushButton.d.ts +10 -0
  752. package/es/core/acroform/PDFAcroPushButton.d.ts.map +1 -0
  753. package/es/core/acroform/PDFAcroPushButton.js +24 -0
  754. package/es/core/acroform/PDFAcroPushButton.js.map +1 -0
  755. package/es/core/acroform/PDFAcroRadioButton.d.ts +14 -0
  756. package/es/core/acroform/PDFAcroRadioButton.d.ts.map +1 -0
  757. package/es/core/acroform/PDFAcroRadioButton.js +55 -0
  758. package/es/core/acroform/PDFAcroRadioButton.js.map +1 -0
  759. package/es/core/acroform/PDFAcroSignature.d.ts +8 -0
  760. package/es/core/acroform/PDFAcroSignature.d.ts.map +1 -0
  761. package/es/core/acroform/PDFAcroSignature.js +14 -0
  762. package/es/core/acroform/PDFAcroSignature.js.map +1 -0
  763. package/es/core/acroform/PDFAcroTerminal.d.ts +17 -0
  764. package/es/core/acroform/PDFAcroTerminal.d.ts.map +1 -0
  765. package/es/core/acroform/PDFAcroTerminal.js +68 -0
  766. package/es/core/acroform/PDFAcroTerminal.js.map +1 -0
  767. package/es/core/acroform/PDFAcroText.d.ts +23 -0
  768. package/es/core/acroform/PDFAcroText.d.ts.map +1 -0
  769. package/es/core/acroform/PDFAcroText.js +71 -0
  770. package/es/core/acroform/PDFAcroText.js.map +1 -0
  771. package/es/core/acroform/flags.d.ts +142 -0
  772. package/es/core/acroform/flags.d.ts.map +1 -0
  773. package/es/core/acroform/flags.js +147 -0
  774. package/es/core/acroform/flags.js.map +1 -0
  775. package/es/core/acroform/index.d.ts +16 -0
  776. package/es/core/acroform/index.d.ts.map +1 -0
  777. package/es/core/acroform/index.js +16 -0
  778. package/es/core/acroform/index.js.map +1 -0
  779. package/es/core/acroform/utils.d.ts +7 -0
  780. package/es/core/acroform/utils.d.ts.map +1 -0
  781. package/es/core/acroform/utils.js +123 -0
  782. package/es/core/acroform/utils.js.map +1 -0
  783. package/es/core/annotation/AppearanceCharacteristics.d.ts +34 -0
  784. package/es/core/annotation/AppearanceCharacteristics.d.ts.map +1 -0
  785. package/es/core/annotation/AppearanceCharacteristics.js +120 -0
  786. package/es/core/annotation/AppearanceCharacteristics.js.map +1 -0
  787. package/es/core/annotation/BorderStyle.d.ts +12 -0
  788. package/es/core/annotation/BorderStyle.d.ts.map +1 -0
  789. package/es/core/annotation/BorderStyle.js +26 -0
  790. package/es/core/annotation/BorderStyle.js.map +1 -0
  791. package/es/core/annotation/PDFAnnotation.d.ts +52 -0
  792. package/es/core/annotation/PDFAnnotation.d.ts.map +1 -0
  793. package/es/core/annotation/PDFAnnotation.js +120 -0
  794. package/es/core/annotation/PDFAnnotation.js.map +1 -0
  795. package/es/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
  796. package/es/core/annotation/PDFWidgetAnnotation.d.ts.map +1 -0
  797. package/es/core/annotation/PDFWidgetAnnotation.js +108 -0
  798. package/es/core/annotation/PDFWidgetAnnotation.js.map +1 -0
  799. package/es/core/annotation/flags.d.ts +80 -0
  800. package/es/core/annotation/flags.d.ts.map +1 -0
  801. package/es/core/annotation/flags.js +82 -0
  802. package/es/core/annotation/flags.js.map +1 -0
  803. package/es/core/annotation/index.d.ts +5 -0
  804. package/es/core/annotation/index.d.ts.map +1 -0
  805. package/es/core/annotation/index.js +5 -0
  806. package/es/core/annotation/index.js.map +1 -0
  807. package/es/core/document/PDFCrossRefSection.d.ts +28 -0
  808. package/es/core/document/PDFCrossRefSection.d.ts.map +1 -0
  809. package/es/core/document/PDFCrossRefSection.js +121 -0
  810. package/es/core/document/PDFCrossRefSection.js.map +1 -0
  811. package/es/core/document/PDFHeader.d.ts +11 -0
  812. package/es/core/document/PDFHeader.d.ts.map +1 -0
  813. package/es/core/document/PDFHeader.js +39 -0
  814. package/es/core/document/PDFHeader.js.map +1 -0
  815. package/es/core/document/PDFTrailer.d.ts +10 -0
  816. package/es/core/document/PDFTrailer.d.ts.map +1 -0
  817. package/es/core/document/PDFTrailer.js +40 -0
  818. package/es/core/document/PDFTrailer.js.map +1 -0
  819. package/es/core/document/PDFTrailerDict.d.ts +11 -0
  820. package/es/core/document/PDFTrailerDict.d.ts.map +1 -0
  821. package/es/core/document/PDFTrailerDict.js +29 -0
  822. package/es/core/document/PDFTrailerDict.js.map +1 -0
  823. package/es/core/embedders/CMap.d.ts +4 -0
  824. package/es/core/embedders/CMap.d.ts.map +1 -0
  825. package/es/core/embedders/CMap.js +40 -0
  826. package/es/core/embedders/CMap.js.map +1 -0
  827. package/es/core/embedders/CustomFontEmbedder.d.ts +45 -0
  828. package/es/core/embedders/CustomFontEmbedder.d.ts.map +1 -0
  829. package/es/core/embedders/CustomFontEmbedder.js +238 -0
  830. package/es/core/embedders/CustomFontEmbedder.js.map +1 -0
  831. package/es/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
  832. package/es/core/embedders/CustomFontSubsetEmbedder.d.ts.map +1 -0
  833. package/es/core/embedders/CustomFontSubsetEmbedder.js +79 -0
  834. package/es/core/embedders/CustomFontSubsetEmbedder.js.map +1 -0
  835. package/es/core/embedders/FileEmbedder.d.ts +34 -0
  836. package/es/core/embedders/FileEmbedder.d.ts.map +1 -0
  837. package/es/core/embedders/FileEmbedder.js +72 -0
  838. package/es/core/embedders/FileEmbedder.js.map +1 -0
  839. package/es/core/embedders/FontFlags.d.ts +14 -0
  840. package/es/core/embedders/FontFlags.d.ts.map +1 -0
  841. package/es/core/embedders/FontFlags.js +37 -0
  842. package/es/core/embedders/FontFlags.js.map +1 -0
  843. package/es/core/embedders/JavaScriptEmbedder.d.ts +11 -0
  844. package/es/core/embedders/JavaScriptEmbedder.d.ts.map +1 -0
  845. package/es/core/embedders/JavaScriptEmbedder.js +34 -0
  846. package/es/core/embedders/JavaScriptEmbedder.js.map +1 -0
  847. package/es/core/embedders/JpegEmbedder.d.ts +24 -0
  848. package/es/core/embedders/JpegEmbedder.d.ts.map +1 -0
  849. package/es/core/embedders/JpegEmbedder.js +105 -0
  850. package/es/core/embedders/JpegEmbedder.js.map +1 -0
  851. package/es/core/embedders/PDFPageEmbedder.d.ts +38 -0
  852. package/es/core/embedders/PDFPageEmbedder.d.ts.map +1 -0
  853. package/es/core/embedders/PDFPageEmbedder.js +89 -0
  854. package/es/core/embedders/PDFPageEmbedder.js.map +1 -0
  855. package/es/core/embedders/PngEmbedder.d.ts +20 -0
  856. package/es/core/embedders/PngEmbedder.d.ts.map +1 -0
  857. package/es/core/embedders/PngEmbedder.js +67 -0
  858. package/es/core/embedders/PngEmbedder.js.map +1 -0
  859. package/es/core/embedders/StandardFontEmbedder.d.ts +37 -0
  860. package/es/core/embedders/StandardFontEmbedder.d.ts.map +1 -0
  861. package/es/core/embedders/StandardFontEmbedder.js +95 -0
  862. package/es/core/embedders/StandardFontEmbedder.js.map +1 -0
  863. package/es/core/errors.d.ts +92 -0
  864. package/es/core/errors.d.ts.map +1 -0
  865. package/es/core/errors.js +320 -0
  866. package/es/core/errors.js.map +1 -0
  867. package/es/core/index.d.ts +48 -0
  868. package/es/core/index.d.ts.map +1 -0
  869. package/es/core/index.js +48 -0
  870. package/es/core/index.js.map +1 -0
  871. package/es/core/interactive/ViewerPreferences.d.ts +348 -0
  872. package/es/core/interactive/ViewerPreferences.d.ts.map +1 -0
  873. package/es/core/interactive/ViewerPreferences.js +507 -0
  874. package/es/core/interactive/ViewerPreferences.js.map +1 -0
  875. package/es/core/objects/PDFArray.d.ts +64 -0
  876. package/es/core/objects/PDFArray.d.ts.map +1 -0
  877. package/es/core/objects/PDFArray.js +115 -0
  878. package/es/core/objects/PDFArray.js.map +1 -0
  879. package/es/core/objects/PDFBool.d.ts +14 -0
  880. package/es/core/objects/PDFBool.d.ts.map +1 -0
  881. package/es/core/objects/PDFBool.js +50 -0
  882. package/es/core/objects/PDFBool.js.map +1 -0
  883. package/es/core/objects/PDFDict.d.ts +62 -0
  884. package/es/core/objects/PDFDict.d.ts.map +1 -0
  885. package/es/core/objects/PDFDict.js +136 -0
  886. package/es/core/objects/PDFDict.js.map +1 -0
  887. package/es/core/objects/PDFHexString.d.ts +17 -0
  888. package/es/core/objects/PDFHexString.d.ts.map +1 -0
  889. package/es/core/objects/PDFHexString.js +72 -0
  890. package/es/core/objects/PDFHexString.js.map +1 -0
  891. package/es/core/objects/PDFInvalidObject.d.ts +12 -0
  892. package/es/core/objects/PDFInvalidObject.d.ts.map +1 -0
  893. package/es/core/objects/PDFInvalidObject.js +30 -0
  894. package/es/core/objects/PDFInvalidObject.js.map +1 -0
  895. package/es/core/objects/PDFName.d.ts +42 -0
  896. package/es/core/objects/PDFName.d.ts.map +1 -0
  897. package/es/core/objects/PDFName.js +136 -0
  898. package/es/core/objects/PDFName.js.map +1 -0
  899. package/es/core/objects/PDFNull.d.ts +11 -0
  900. package/es/core/objects/PDFNull.d.ts.map +1 -0
  901. package/es/core/objects/PDFNull.js +31 -0
  902. package/es/core/objects/PDFNull.js.map +1 -0
  903. package/es/core/objects/PDFNumber.d.ts +16 -0
  904. package/es/core/objects/PDFNumber.d.ts.map +1 -0
  905. package/es/core/objects/PDFNumber.js +36 -0
  906. package/es/core/objects/PDFNumber.js.map +1 -0
  907. package/es/core/objects/PDFObject.d.ts +9 -0
  908. package/es/core/objects/PDFObject.d.ts.map +1 -0
  909. package/es/core/objects/PDFObject.js +20 -0
  910. package/es/core/objects/PDFObject.js.map +1 -0
  911. package/es/core/objects/PDFRawStream.d.ts +15 -0
  912. package/es/core/objects/PDFRawStream.d.ts.map +1 -0
  913. package/es/core/objects/PDFRawStream.js +32 -0
  914. package/es/core/objects/PDFRawStream.js.map +1 -0
  915. package/es/core/objects/PDFRef.d.ts +14 -0
  916. package/es/core/objects/PDFRef.d.ts.map +1 -0
  917. package/es/core/objects/PDFRef.js +45 -0
  918. package/es/core/objects/PDFRef.js.map +1 -0
  919. package/es/core/objects/PDFStream.d.ts +17 -0
  920. package/es/core/objects/PDFStream.d.ts.map +1 -0
  921. package/es/core/objects/PDFStream.js +73 -0
  922. package/es/core/objects/PDFStream.js.map +1 -0
  923. package/es/core/objects/PDFString.d.ts +17 -0
  924. package/es/core/objects/PDFString.d.ts.map +1 -0
  925. package/es/core/objects/PDFString.js +114 -0
  926. package/es/core/objects/PDFString.js.map +1 -0
  927. package/es/core/operators/PDFOperator.d.ts +20 -0
  928. package/es/core/operators/PDFOperator.d.ts.map +1 -0
  929. package/es/core/operators/PDFOperator.js +55 -0
  930. package/es/core/operators/PDFOperator.js.map +1 -0
  931. package/es/core/operators/PDFOperatorNames.d.ts +77 -0
  932. package/es/core/operators/PDFOperatorNames.d.ts.map +1 -0
  933. package/es/core/operators/PDFOperatorNames.js +86 -0
  934. package/es/core/operators/PDFOperatorNames.js.map +1 -0
  935. package/es/core/parser/BaseParser.d.ts +15 -0
  936. package/es/core/parser/BaseParser.d.ts.map +1 -0
  937. package/es/core/parser/BaseParser.js +107 -0
  938. package/es/core/parser/BaseParser.js.map +1 -0
  939. package/es/core/parser/ByteStream.d.ts +27 -0
  940. package/es/core/parser/ByteStream.d.ts.map +1 -0
  941. package/es/core/parser/ByteStream.js +61 -0
  942. package/es/core/parser/ByteStream.js.map +1 -0
  943. package/es/core/parser/PDFObjectParser.d.ts +30 -0
  944. package/es/core/parser/PDFObjectParser.d.ts.map +1 -0
  945. package/es/core/parser/PDFObjectParser.js +231 -0
  946. package/es/core/parser/PDFObjectParser.js.map +1 -0
  947. package/es/core/parser/PDFObjectStreamParser.d.ts +14 -0
  948. package/es/core/parser/PDFObjectStreamParser.d.ts.map +1 -0
  949. package/es/core/parser/PDFObjectStreamParser.js +68 -0
  950. package/es/core/parser/PDFObjectStreamParser.js.map +1 -0
  951. package/es/core/parser/PDFParser.d.ts +46 -0
  952. package/es/core/parser/PDFParser.d.ts.map +1 -0
  953. package/es/core/parser/PDFParser.js +354 -0
  954. package/es/core/parser/PDFParser.js.map +1 -0
  955. package/es/core/parser/PDFXRefStreamParser.d.ts +22 -0
  956. package/es/core/parser/PDFXRefStreamParser.d.ts.map +1 -0
  957. package/es/core/parser/PDFXRefStreamParser.js +89 -0
  958. package/es/core/parser/PDFXRefStreamParser.js.map +1 -0
  959. package/es/core/streams/Ascii85Stream.d.ts +10 -0
  960. package/es/core/streams/Ascii85Stream.d.ts.map +1 -0
  961. package/es/core/streams/Ascii85Stream.js +85 -0
  962. package/es/core/streams/Ascii85Stream.js.map +1 -0
  963. package/es/core/streams/AsciiHexStream.d.ts +10 -0
  964. package/es/core/streams/AsciiHexStream.d.ts.map +1 -0
  965. package/es/core/streams/AsciiHexStream.js +73 -0
  966. package/es/core/streams/AsciiHexStream.js.map +1 -0
  967. package/es/core/streams/DecodeStream.d.ts +27 -0
  968. package/es/core/streams/DecodeStream.d.ts.map +1 -0
  969. package/es/core/streams/DecodeStream.js +146 -0
  970. package/es/core/streams/DecodeStream.js.map +1 -0
  971. package/es/core/streams/FlateStream.d.ts +14 -0
  972. package/es/core/streams/FlateStream.d.ts.map +1 -0
  973. package/es/core/streams/FlateStream.js +369 -0
  974. package/es/core/streams/FlateStream.js.map +1 -0
  975. package/es/core/streams/LZWStream.d.ts +13 -0
  976. package/es/core/streams/LZWStream.d.ts.map +1 -0
  977. package/es/core/streams/LZWStream.js +135 -0
  978. package/es/core/streams/LZWStream.js.map +1 -0
  979. package/es/core/streams/RunLengthStream.d.ts +9 -0
  980. package/es/core/streams/RunLengthStream.d.ts.map +1 -0
  981. package/es/core/streams/RunLengthStream.js +53 -0
  982. package/es/core/streams/RunLengthStream.js.map +1 -0
  983. package/es/core/streams/Stream.d.ts +35 -0
  984. package/es/core/streams/Stream.d.ts.map +1 -0
  985. package/es/core/streams/Stream.js +104 -0
  986. package/es/core/streams/Stream.js.map +1 -0
  987. package/es/core/streams/decode.d.ts +4 -0
  988. package/es/core/streams/decode.d.ts.map +1 -0
  989. package/es/core/streams/decode.js +55 -0
  990. package/es/core/streams/decode.js.map +1 -0
  991. package/es/core/structures/PDFCatalog.d.ts +28 -0
  992. package/es/core/structures/PDFCatalog.d.ts.map +1 -0
  993. package/es/core/structures/PDFCatalog.js +77 -0
  994. package/es/core/structures/PDFCatalog.js.map +1 -0
  995. package/es/core/structures/PDFContentStream.d.ts +16 -0
  996. package/es/core/structures/PDFContentStream.d.ts.map +1 -0
  997. package/es/core/structures/PDFContentStream.js +58 -0
  998. package/es/core/structures/PDFContentStream.js.map +1 -0
  999. package/es/core/structures/PDFCrossRefStream.d.ts +54 -0
  1000. package/es/core/structures/PDFCrossRefStream.d.ts.map +1 -0
  1001. package/es/core/structures/PDFCrossRefStream.js +184 -0
  1002. package/es/core/structures/PDFCrossRefStream.js.map +1 -0
  1003. package/es/core/structures/PDFFlateStream.d.ts +14 -0
  1004. package/es/core/structures/PDFFlateStream.d.ts.map +1 -0
  1005. package/es/core/structures/PDFFlateStream.js +33 -0
  1006. package/es/core/structures/PDFFlateStream.js.map +1 -0
  1007. package/es/core/structures/PDFObjectStream.d.ts +21 -0
  1008. package/es/core/structures/PDFObjectStream.d.ts.map +1 -0
  1009. package/es/core/structures/PDFObjectStream.js +75 -0
  1010. package/es/core/structures/PDFObjectStream.js.map +1 -0
  1011. package/es/core/structures/PDFPageLeaf.d.ts +55 -0
  1012. package/es/core/structures/PDFPageLeaf.d.ts.map +1 -0
  1013. package/es/core/structures/PDFPageLeaf.js +204 -0
  1014. package/es/core/structures/PDFPageLeaf.js.map +1 -0
  1015. package/es/core/structures/PDFPageTree.d.ts +42 -0
  1016. package/es/core/structures/PDFPageTree.d.ts.map +1 -0
  1017. package/es/core/structures/PDFPageTree.js +175 -0
  1018. package/es/core/structures/PDFPageTree.js.map +1 -0
  1019. package/es/core/syntax/CharCodes.d.ts +62 -0
  1020. package/es/core/syntax/CharCodes.d.ts.map +1 -0
  1021. package/es/core/syntax/CharCodes.js +63 -0
  1022. package/es/core/syntax/CharCodes.js.map +1 -0
  1023. package/es/core/syntax/Delimiters.d.ts +2 -0
  1024. package/es/core/syntax/Delimiters.d.ts.map +1 -0
  1025. package/es/core/syntax/Delimiters.js +13 -0
  1026. package/es/core/syntax/Delimiters.js.map +1 -0
  1027. package/es/core/syntax/Irregular.d.ts +2 -0
  1028. package/es/core/syntax/Irregular.d.ts.map +1 -0
  1029. package/es/core/syntax/Irregular.js +9 -0
  1030. package/es/core/syntax/Irregular.js.map +1 -0
  1031. package/es/core/syntax/Keywords.d.ts +23 -0
  1032. package/es/core/syntax/Keywords.d.ts.map +1 -0
  1033. package/es/core/syntax/Keywords.js +81 -0
  1034. package/es/core/syntax/Keywords.js.map +1 -0
  1035. package/es/core/syntax/Numeric.d.ts +4 -0
  1036. package/es/core/syntax/Numeric.d.ts.map +1 -0
  1037. package/es/core/syntax/Numeric.js +21 -0
  1038. package/es/core/syntax/Numeric.js.map +1 -0
  1039. package/es/core/syntax/Whitespace.d.ts +2 -0
  1040. package/es/core/syntax/Whitespace.d.ts.map +1 -0
  1041. package/es/core/syntax/Whitespace.js +9 -0
  1042. package/es/core/syntax/Whitespace.js.map +1 -0
  1043. package/es/core/writers/PDFStreamWriter.d.ts +20 -0
  1044. package/es/core/writers/PDFStreamWriter.d.ts.map +1 -0
  1045. package/es/core/writers/PDFStreamWriter.js +111 -0
  1046. package/es/core/writers/PDFStreamWriter.js.map +1 -0
  1047. package/es/core/writers/PDFWriter.d.ts +30 -0
  1048. package/es/core/writers/PDFWriter.d.ts.map +1 -0
  1049. package/es/core/writers/PDFWriter.js +142 -0
  1050. package/es/core/writers/PDFWriter.js.map +1 -0
  1051. package/es/index.d.ts +5 -0
  1052. package/es/index.d.ts.map +1 -0
  1053. package/es/index.js +5 -0
  1054. package/es/index.js.map +1 -0
  1055. package/es/types/fontkit.d.ts +598 -0
  1056. package/es/types/fontkit.d.ts.map +1 -0
  1057. package/es/types/fontkit.js +1 -0
  1058. package/es/types/fontkit.js.map +1 -0
  1059. package/es/types/index.d.ts +2 -0
  1060. package/es/types/index.d.ts.map +1 -0
  1061. package/es/types/index.js +1 -0
  1062. package/es/types/index.js.map +1 -0
  1063. package/es/types/matrix.d.ts +22 -0
  1064. package/es/types/matrix.d.ts.map +1 -0
  1065. package/es/types/matrix.js +2 -0
  1066. package/es/types/matrix.js.map +1 -0
  1067. package/es/utils/Cache.d.ts +11 -0
  1068. package/es/utils/Cache.d.ts.map +1 -0
  1069. package/es/utils/Cache.js +21 -0
  1070. package/es/utils/Cache.js.map +1 -0
  1071. package/es/utils/arrays.d.ts +16 -0
  1072. package/es/utils/arrays.d.ts.map +1 -0
  1073. package/es/utils/arrays.js +129 -0
  1074. package/es/utils/arrays.js.map +1 -0
  1075. package/es/utils/async.d.ts +6 -0
  1076. package/es/utils/async.d.ts.map +1 -0
  1077. package/es/utils/async.js +10 -0
  1078. package/es/utils/async.js.map +1 -0
  1079. package/es/utils/base64.d.ts +11 -0
  1080. package/es/utils/base64.d.ts.map +1 -0
  1081. package/es/utils/base64.js +84 -0
  1082. package/es/utils/base64.js.map +1 -0
  1083. package/es/utils/errors.d.ts +2 -0
  1084. package/es/utils/errors.d.ts.map +1 -0
  1085. package/es/utils/errors.js +4 -0
  1086. package/es/utils/errors.js.map +1 -0
  1087. package/es/utils/index.d.ts +12 -0
  1088. package/es/utils/index.d.ts.map +1 -0
  1089. package/es/utils/index.js +12 -0
  1090. package/es/utils/index.js.map +1 -0
  1091. package/es/utils/numbers.d.ts +24 -0
  1092. package/es/utils/numbers.d.ts.map +1 -0
  1093. package/es/utils/numbers.js +54 -0
  1094. package/es/utils/numbers.js.map +1 -0
  1095. package/es/utils/objects.d.ts +16 -0
  1096. package/es/utils/objects.d.ts.map +1 -0
  1097. package/es/utils/objects.js +8 -0
  1098. package/es/utils/objects.js.map +1 -0
  1099. package/es/utils/pdfDocEncoding.d.ts +8 -0
  1100. package/es/utils/pdfDocEncoding.d.ts.map +1 -0
  1101. package/es/utils/pdfDocEncoding.js +66 -0
  1102. package/es/utils/pdfDocEncoding.js.map +1 -0
  1103. package/es/utils/png.d.ts +18 -0
  1104. package/es/utils/png.d.ts.map +1 -0
  1105. package/es/utils/png.js +59 -0
  1106. package/es/utils/png.js.map +1 -0
  1107. package/es/utils/rng.d.ts +14 -0
  1108. package/es/utils/rng.d.ts.map +1 -0
  1109. package/es/utils/rng.js +20 -0
  1110. package/es/utils/rng.js.map +1 -0
  1111. package/es/utils/strings.d.ts +25 -0
  1112. package/es/utils/strings.d.ts.map +1 -0
  1113. package/es/utils/strings.js +138 -0
  1114. package/es/utils/strings.js.map +1 -0
  1115. package/es/utils/unicode.d.ts +187 -0
  1116. package/es/utils/unicode.d.ts.map +1 -0
  1117. package/es/utils/unicode.js +367 -0
  1118. package/es/utils/unicode.js.map +1 -0
  1119. package/es/utils/validators.d.ts +27 -0
  1120. package/es/utils/validators.d.ts.map +1 -0
  1121. package/es/utils/validators.js +180 -0
  1122. package/es/utils/validators.js.map +1 -0
  1123. package/package.json +141 -0
  1124. package/src/api/Embeddable.ts +7 -0
  1125. package/src/api/PDFDocument.ts +1395 -0
  1126. package/src/api/PDFDocumentOptions.ts +44 -0
  1127. package/src/api/PDFEmbeddedFile.ts +90 -0
  1128. package/src/api/PDFEmbeddedPage.ts +104 -0
  1129. package/src/api/PDFFont.ts +154 -0
  1130. package/src/api/PDFImage.ts +143 -0
  1131. package/src/api/PDFJavaScript.ts +82 -0
  1132. package/src/api/PDFPage.ts +1621 -0
  1133. package/src/api/PDFPageOptions.ts +158 -0
  1134. package/src/api/StandardFonts.ts +16 -0
  1135. package/src/api/colors.ts +104 -0
  1136. package/src/api/errors.ts +111 -0
  1137. package/src/api/form/PDFButton.ts +267 -0
  1138. package/src/api/form/PDFCheckBox.ts +262 -0
  1139. package/src/api/form/PDFDropdown.ts +652 -0
  1140. package/src/api/form/PDFField.ts +521 -0
  1141. package/src/api/form/PDFForm.ts +852 -0
  1142. package/src/api/form/PDFOptionList.ts +571 -0
  1143. package/src/api/form/PDFRadioGroup.ts +471 -0
  1144. package/src/api/form/PDFSignature.ts +53 -0
  1145. package/src/api/form/PDFTextField.ts +826 -0
  1146. package/src/api/form/appearances.ts +665 -0
  1147. package/src/api/form/index.ts +10 -0
  1148. package/src/api/image/alignment.ts +5 -0
  1149. package/src/api/image/index.ts +1 -0
  1150. package/src/api/index.ts +20 -0
  1151. package/src/api/objects.ts +10 -0
  1152. package/src/api/operations.ts +800 -0
  1153. package/src/api/operators.ts +360 -0
  1154. package/src/api/rotations.ts +87 -0
  1155. package/src/api/sizes.ts +52 -0
  1156. package/src/api/svgPath.ts +489 -0
  1157. package/src/api/text/alignment.ts +5 -0
  1158. package/src/api/text/index.ts +2 -0
  1159. package/src/api/text/layout.ts +343 -0
  1160. package/src/core/PDFContext.ts +299 -0
  1161. package/src/core/PDFObjectCopier.ts +143 -0
  1162. package/src/core/acroform/PDFAcroButton.ts +114 -0
  1163. package/src/core/acroform/PDFAcroCheckBox.ts +49 -0
  1164. package/src/core/acroform/PDFAcroChoice.ts +153 -0
  1165. package/src/core/acroform/PDFAcroComboBox.ts +22 -0
  1166. package/src/core/acroform/PDFAcroField.ts +167 -0
  1167. package/src/core/acroform/PDFAcroForm.ts +102 -0
  1168. package/src/core/acroform/PDFAcroListBox.ts +20 -0
  1169. package/src/core/acroform/PDFAcroNonTerminal.ts +34 -0
  1170. package/src/core/acroform/PDFAcroPushButton.ts +22 -0
  1171. package/src/core/acroform/PDFAcroRadioButton.ts +58 -0
  1172. package/src/core/acroform/PDFAcroSignature.ts +10 -0
  1173. package/src/core/acroform/PDFAcroTerminal.ts +71 -0
  1174. package/src/core/acroform/PDFAcroText.ts +76 -0
  1175. package/src/core/acroform/flags.ts +162 -0
  1176. package/src/core/acroform/index.ts +15 -0
  1177. package/src/core/acroform/utils.ts +135 -0
  1178. package/src/core/annotation/AppearanceCharacteristics.ts +133 -0
  1179. package/src/core/annotation/BorderStyle.ts +31 -0
  1180. package/src/core/annotation/PDFAnnotation.ts +148 -0
  1181. package/src/core/annotation/PDFWidgetAnnotation.ts +112 -0
  1182. package/src/core/annotation/flags.ts +90 -0
  1183. package/src/core/annotation/index.ts +4 -0
  1184. package/src/core/document/PDFCrossRefSection.ts +173 -0
  1185. package/src/core/document/PDFHeader.ts +49 -0
  1186. package/src/core/document/PDFTrailer.ts +49 -0
  1187. package/src/core/document/PDFTrailerDict.ts +39 -0
  1188. package/src/core/embedders/CMap.ts +70 -0
  1189. package/src/core/embedders/CustomFontEmbedder.ts +249 -0
  1190. package/src/core/embedders/CustomFontSubsetEmbedder.ts +93 -0
  1191. package/src/core/embedders/FileEmbedder.ts +95 -0
  1192. package/src/core/embedders/FontFlags.ts +45 -0
  1193. package/src/core/embedders/JavaScriptEmbedder.ts +34 -0
  1194. package/src/core/embedders/JpegEmbedder.ts +127 -0
  1195. package/src/core/embedders/PDFPageEmbedder.ts +141 -0
  1196. package/src/core/embedders/PngEmbedder.ts +69 -0
  1197. package/src/core/embedders/StandardFontEmbedder.ts +130 -0
  1198. package/src/core/errors.ts +221 -0
  1199. package/src/core/index.ts +69 -0
  1200. package/src/core/interactive/ViewerPreferences.ts +579 -0
  1201. package/src/core/objects/PDFArray.ts +185 -0
  1202. package/src/core/objects/PDFBool.ts +53 -0
  1203. package/src/core/objects/PDFDict.ts +226 -0
  1204. package/src/core/objects/PDFHexString.ts +94 -0
  1205. package/src/core/objects/PDFInvalidObject.ts +34 -0
  1206. package/src/core/objects/PDFName.ts +159 -0
  1207. package/src/core/objects/PDFNull.ts +30 -0
  1208. package/src/core/objects/PDFNumber.ts +44 -0
  1209. package/src/core/objects/PDFObject.ts +22 -0
  1210. package/src/core/objects/PDFRawStream.ts +38 -0
  1211. package/src/core/objects/PDFRef.ts +55 -0
  1212. package/src/core/objects/PDFStream.ts +93 -0
  1213. package/src/core/objects/PDFString.ts +118 -0
  1214. package/src/core/operators/PDFOperator.ts +79 -0
  1215. package/src/core/operators/PDFOperatorNames.ts +92 -0
  1216. package/src/core/parser/BaseParser.ts +119 -0
  1217. package/src/core/parser/ByteStream.ts +76 -0
  1218. package/src/core/parser/PDFObjectParser.ts +274 -0
  1219. package/src/core/parser/PDFObjectStreamParser.ts +67 -0
  1220. package/src/core/parser/PDFParser.ts +364 -0
  1221. package/src/core/parser/PDFXRefStreamParser.ts +130 -0
  1222. package/src/core/streams/Ascii85Stream.ts +98 -0
  1223. package/src/core/streams/AsciiHexStream.ts +77 -0
  1224. package/src/core/streams/DecodeStream.ts +170 -0
  1225. package/src/core/streams/FlateStream.ts +407 -0
  1226. package/src/core/streams/LZWStream.ts +164 -0
  1227. package/src/core/streams/RunLengthStream.ts +55 -0
  1228. package/src/core/streams/Stream.ts +132 -0
  1229. package/src/core/streams/decode.ts +73 -0
  1230. package/src/core/structures/PDFCatalog.ts +85 -0
  1231. package/src/core/structures/PDFContentStream.ts +58 -0
  1232. package/src/core/structures/PDFCrossRefStream.ts +246 -0
  1233. package/src/core/structures/PDFFlateStream.ts +43 -0
  1234. package/src/core/structures/PDFObjectStream.ts +101 -0
  1235. package/src/core/structures/PDFPageLeaf.ts +263 -0
  1236. package/src/core/structures/PDFPageTree.ts +195 -0
  1237. package/src/core/syntax/CharCodes.ts +62 -0
  1238. package/src/core/syntax/Delimiters.ts +14 -0
  1239. package/src/core/syntax/Irregular.ts +10 -0
  1240. package/src/core/syntax/Keywords.ts +83 -0
  1241. package/src/core/syntax/Numeric.ts +26 -0
  1242. package/src/core/syntax/Whitespace.ts +10 -0
  1243. package/src/core/writers/PDFStreamWriter.ts +123 -0
  1244. package/src/core/writers/PDFWriter.ts +156 -0
  1245. package/src/index.ts +4 -0
  1246. package/src/types/fontkit.ts +656 -0
  1247. package/src/types/index.ts +1 -0
  1248. package/src/types/matrix.ts +29 -0
  1249. package/src/utils/Cache.ts +26 -0
  1250. package/src/utils/arrays.ts +146 -0
  1251. package/src/utils/async.ts +8 -0
  1252. package/src/utils/base64.ts +99 -0
  1253. package/src/utils/errors.ts +3 -0
  1254. package/src/utils/index.ts +11 -0
  1255. package/src/utils/numbers.ts +55 -0
  1256. package/src/utils/objects.ts +13 -0
  1257. package/src/utils/pdfDocEncoding.ts +69 -0
  1258. package/src/utils/png.ts +70 -0
  1259. package/src/utils/rng.ts +21 -0
  1260. package/src/utils/strings.ts +182 -0
  1261. package/src/utils/unicode.ts +386 -0
  1262. package/src/utils/validators.ts +228 -0
  1263. package/ts3.4/apps/deno/dummy.d.ts +20 -0
  1264. package/ts3.4/cjs/api/Embeddable.d.ts +8 -0
  1265. package/ts3.4/cjs/api/PDFDocument.d.ts +779 -0
  1266. package/ts3.4/cjs/api/PDFDocumentOptions.d.ts +38 -0
  1267. package/ts3.4/cjs/api/PDFEmbeddedFile.d.ts +39 -0
  1268. package/ts3.4/cjs/api/PDFEmbeddedPage.d.ts +74 -0
  1269. package/ts3.4/cjs/api/PDFFont.d.ts +95 -0
  1270. package/ts3.4/cjs/api/PDFImage.d.ts +96 -0
  1271. package/ts3.4/cjs/api/PDFJavaScript.d.ts +39 -0
  1272. package/ts3.4/cjs/api/PDFPage.d.ts +898 -0
  1273. package/ts3.4/cjs/api/PDFPageOptions.d.ts +155 -0
  1274. package/ts3.4/cjs/api/StandardFonts.d.ts +17 -0
  1275. package/ts3.4/cjs/api/colors.d.ts +31 -0
  1276. package/ts3.4/cjs/api/errors.d.ts +43 -0
  1277. package/ts3.4/cjs/api/form/PDFButton.d.ts +138 -0
  1278. package/ts3.4/cjs/api/form/PDFCheckBox.d.ts +143 -0
  1279. package/ts3.4/cjs/api/form/PDFDropdown.d.ts +403 -0
  1280. package/ts3.4/cjs/api/form/PDFField.d.ts +204 -0
  1281. package/ts3.4/cjs/api/form/PDFForm.d.ts +412 -0
  1282. package/ts3.4/cjs/api/form/PDFOptionList.d.ts +336 -0
  1283. package/ts3.4/cjs/api/form/PDFRadioGroup.d.ts +253 -0
  1284. package/ts3.4/cjs/api/form/PDFSignature.d.ts +30 -0
  1285. package/ts3.4/cjs/api/form/PDFTextField.d.ts +538 -0
  1286. package/ts3.4/cjs/api/form/appearances.d.ts +42 -0
  1287. package/ts3.4/cjs/api/form/index.d.ts +11 -0
  1288. package/ts3.4/cjs/api/image/alignment.d.ts +6 -0
  1289. package/ts3.4/cjs/api/image/index.d.ts +2 -0
  1290. package/ts3.4/cjs/api/index.d.ts +21 -0
  1291. package/ts3.4/cjs/api/objects.d.ts +5 -0
  1292. package/ts3.4/cjs/api/operations.d.ts +212 -0
  1293. package/ts3.4/cjs/api/operators.d.ts +86 -0
  1294. package/ts3.4/cjs/api/rotations.d.ts +39 -0
  1295. package/ts3.4/cjs/api/sizes.d.ts +53 -0
  1296. package/ts3.4/cjs/api/svgPath.d.ts +3 -0
  1297. package/ts3.4/cjs/api/text/alignment.d.ts +6 -0
  1298. package/ts3.4/cjs/api/text/index.d.ts +3 -0
  1299. package/ts3.4/cjs/api/text/layout.d.ts +55 -0
  1300. package/ts3.4/cjs/core/PDFContext.d.ts +84 -0
  1301. package/ts3.4/cjs/core/PDFObjectCopier.d.ts +38 -0
  1302. package/ts3.4/cjs/core/acroform/PDFAcroButton.d.ts +22 -0
  1303. package/ts3.4/cjs/core/acroform/PDFAcroCheckBox.d.ts +14 -0
  1304. package/ts3.4/cjs/core/acroform/PDFAcroChoice.d.ts +21 -0
  1305. package/ts3.4/cjs/core/acroform/PDFAcroComboBox.d.ts +10 -0
  1306. package/ts3.4/cjs/core/acroform/PDFAcroField.d.ts +37 -0
  1307. package/ts3.4/cjs/core/acroform/PDFAcroForm.d.ts +21 -0
  1308. package/ts3.4/cjs/core/acroform/PDFAcroListBox.d.ts +10 -0
  1309. package/ts3.4/cjs/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
  1310. package/ts3.4/cjs/core/acroform/PDFAcroPushButton.d.ts +10 -0
  1311. package/ts3.4/cjs/core/acroform/PDFAcroRadioButton.d.ts +14 -0
  1312. package/ts3.4/cjs/core/acroform/PDFAcroSignature.d.ts +8 -0
  1313. package/ts3.4/cjs/core/acroform/PDFAcroTerminal.d.ts +17 -0
  1314. package/ts3.4/cjs/core/acroform/PDFAcroText.d.ts +23 -0
  1315. package/ts3.4/cjs/core/acroform/flags.d.ts +142 -0
  1316. package/ts3.4/cjs/core/acroform/index.d.ts +16 -0
  1317. package/ts3.4/cjs/core/acroform/utils.d.ts +7 -0
  1318. package/ts3.4/cjs/core/annotation/AppearanceCharacteristics.d.ts +34 -0
  1319. package/ts3.4/cjs/core/annotation/BorderStyle.d.ts +12 -0
  1320. package/ts3.4/cjs/core/annotation/PDFAnnotation.d.ts +52 -0
  1321. package/ts3.4/cjs/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
  1322. package/ts3.4/cjs/core/annotation/flags.d.ts +80 -0
  1323. package/ts3.4/cjs/core/annotation/index.d.ts +5 -0
  1324. package/ts3.4/cjs/core/document/PDFCrossRefSection.d.ts +28 -0
  1325. package/ts3.4/cjs/core/document/PDFHeader.d.ts +11 -0
  1326. package/ts3.4/cjs/core/document/PDFTrailer.d.ts +10 -0
  1327. package/ts3.4/cjs/core/document/PDFTrailerDict.d.ts +11 -0
  1328. package/ts3.4/cjs/core/embedders/CMap.d.ts +4 -0
  1329. package/ts3.4/cjs/core/embedders/CustomFontEmbedder.d.ts +45 -0
  1330. package/ts3.4/cjs/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
  1331. package/ts3.4/cjs/core/embedders/FileEmbedder.d.ts +34 -0
  1332. package/ts3.4/cjs/core/embedders/FontFlags.d.ts +14 -0
  1333. package/ts3.4/cjs/core/embedders/JavaScriptEmbedder.d.ts +11 -0
  1334. package/ts3.4/cjs/core/embedders/JpegEmbedder.d.ts +24 -0
  1335. package/ts3.4/cjs/core/embedders/PDFPageEmbedder.d.ts +38 -0
  1336. package/ts3.4/cjs/core/embedders/PngEmbedder.d.ts +20 -0
  1337. package/ts3.4/cjs/core/embedders/StandardFontEmbedder.d.ts +37 -0
  1338. package/ts3.4/cjs/core/errors.d.ts +92 -0
  1339. package/ts3.4/cjs/core/index.d.ts +48 -0
  1340. package/ts3.4/cjs/core/interactive/ViewerPreferences.d.ts +348 -0
  1341. package/ts3.4/cjs/core/objects/PDFArray.d.ts +64 -0
  1342. package/ts3.4/cjs/core/objects/PDFBool.d.ts +14 -0
  1343. package/ts3.4/cjs/core/objects/PDFDict.d.ts +62 -0
  1344. package/ts3.4/cjs/core/objects/PDFHexString.d.ts +17 -0
  1345. package/ts3.4/cjs/core/objects/PDFInvalidObject.d.ts +12 -0
  1346. package/ts3.4/cjs/core/objects/PDFName.d.ts +42 -0
  1347. package/ts3.4/cjs/core/objects/PDFNull.d.ts +11 -0
  1348. package/ts3.4/cjs/core/objects/PDFNumber.d.ts +16 -0
  1349. package/ts3.4/cjs/core/objects/PDFObject.d.ts +9 -0
  1350. package/ts3.4/cjs/core/objects/PDFRawStream.d.ts +15 -0
  1351. package/ts3.4/cjs/core/objects/PDFRef.d.ts +14 -0
  1352. package/ts3.4/cjs/core/objects/PDFStream.d.ts +17 -0
  1353. package/ts3.4/cjs/core/objects/PDFString.d.ts +17 -0
  1354. package/ts3.4/cjs/core/operators/PDFOperator.d.ts +20 -0
  1355. package/ts3.4/cjs/core/operators/PDFOperatorNames.d.ts +77 -0
  1356. package/ts3.4/cjs/core/parser/BaseParser.d.ts +15 -0
  1357. package/ts3.4/cjs/core/parser/ByteStream.d.ts +27 -0
  1358. package/ts3.4/cjs/core/parser/PDFObjectParser.d.ts +30 -0
  1359. package/ts3.4/cjs/core/parser/PDFObjectStreamParser.d.ts +14 -0
  1360. package/ts3.4/cjs/core/parser/PDFParser.d.ts +46 -0
  1361. package/ts3.4/cjs/core/parser/PDFXRefStreamParser.d.ts +22 -0
  1362. package/ts3.4/cjs/core/streams/Ascii85Stream.d.ts +10 -0
  1363. package/ts3.4/cjs/core/streams/AsciiHexStream.d.ts +10 -0
  1364. package/ts3.4/cjs/core/streams/DecodeStream.d.ts +27 -0
  1365. package/ts3.4/cjs/core/streams/FlateStream.d.ts +14 -0
  1366. package/ts3.4/cjs/core/streams/LZWStream.d.ts +13 -0
  1367. package/ts3.4/cjs/core/streams/RunLengthStream.d.ts +9 -0
  1368. package/ts3.4/cjs/core/streams/Stream.d.ts +35 -0
  1369. package/ts3.4/cjs/core/streams/decode.d.ts +4 -0
  1370. package/ts3.4/cjs/core/structures/PDFCatalog.d.ts +28 -0
  1371. package/ts3.4/cjs/core/structures/PDFContentStream.d.ts +16 -0
  1372. package/ts3.4/cjs/core/structures/PDFCrossRefStream.d.ts +54 -0
  1373. package/ts3.4/cjs/core/structures/PDFFlateStream.d.ts +14 -0
  1374. package/ts3.4/cjs/core/structures/PDFObjectStream.d.ts +21 -0
  1375. package/ts3.4/cjs/core/structures/PDFPageLeaf.d.ts +55 -0
  1376. package/ts3.4/cjs/core/structures/PDFPageTree.d.ts +42 -0
  1377. package/ts3.4/cjs/core/syntax/CharCodes.d.ts +62 -0
  1378. package/ts3.4/cjs/core/syntax/Delimiters.d.ts +2 -0
  1379. package/ts3.4/cjs/core/syntax/Irregular.d.ts +2 -0
  1380. package/ts3.4/cjs/core/syntax/Keywords.d.ts +23 -0
  1381. package/ts3.4/cjs/core/syntax/Numeric.d.ts +4 -0
  1382. package/ts3.4/cjs/core/syntax/Whitespace.d.ts +2 -0
  1383. package/ts3.4/cjs/core/writers/PDFStreamWriter.d.ts +20 -0
  1384. package/ts3.4/cjs/core/writers/PDFWriter.d.ts +30 -0
  1385. package/ts3.4/cjs/index.d.ts +5 -0
  1386. package/ts3.4/cjs/types/fontkit.d.ts +598 -0
  1387. package/ts3.4/cjs/types/index.d.ts +2 -0
  1388. package/ts3.4/cjs/types/matrix.d.ts +22 -0
  1389. package/ts3.4/cjs/utils/Cache.d.ts +11 -0
  1390. package/ts3.4/cjs/utils/arrays.d.ts +16 -0
  1391. package/ts3.4/cjs/utils/async.d.ts +6 -0
  1392. package/ts3.4/cjs/utils/base64.d.ts +11 -0
  1393. package/ts3.4/cjs/utils/errors.d.ts +2 -0
  1394. package/ts3.4/cjs/utils/index.d.ts +12 -0
  1395. package/ts3.4/cjs/utils/numbers.d.ts +24 -0
  1396. package/ts3.4/cjs/utils/objects.d.ts +16 -0
  1397. package/ts3.4/cjs/utils/pdfDocEncoding.d.ts +8 -0
  1398. package/ts3.4/cjs/utils/png.d.ts +18 -0
  1399. package/ts3.4/cjs/utils/rng.d.ts +14 -0
  1400. package/ts3.4/cjs/utils/strings.d.ts +25 -0
  1401. package/ts3.4/cjs/utils/unicode.d.ts +187 -0
  1402. package/ts3.4/cjs/utils/validators.d.ts +27 -0
  1403. package/ts3.4/es/api/Embeddable.d.ts +8 -0
  1404. package/ts3.4/es/api/PDFDocument.d.ts +779 -0
  1405. package/ts3.4/es/api/PDFDocumentOptions.d.ts +38 -0
  1406. package/ts3.4/es/api/PDFEmbeddedFile.d.ts +39 -0
  1407. package/ts3.4/es/api/PDFEmbeddedPage.d.ts +74 -0
  1408. package/ts3.4/es/api/PDFFont.d.ts +95 -0
  1409. package/ts3.4/es/api/PDFImage.d.ts +96 -0
  1410. package/ts3.4/es/api/PDFJavaScript.d.ts +39 -0
  1411. package/ts3.4/es/api/PDFPage.d.ts +898 -0
  1412. package/ts3.4/es/api/PDFPageOptions.d.ts +155 -0
  1413. package/ts3.4/es/api/StandardFonts.d.ts +17 -0
  1414. package/ts3.4/es/api/colors.d.ts +31 -0
  1415. package/ts3.4/es/api/errors.d.ts +43 -0
  1416. package/ts3.4/es/api/form/PDFButton.d.ts +138 -0
  1417. package/ts3.4/es/api/form/PDFCheckBox.d.ts +143 -0
  1418. package/ts3.4/es/api/form/PDFDropdown.d.ts +403 -0
  1419. package/ts3.4/es/api/form/PDFField.d.ts +204 -0
  1420. package/ts3.4/es/api/form/PDFForm.d.ts +412 -0
  1421. package/ts3.4/es/api/form/PDFOptionList.d.ts +336 -0
  1422. package/ts3.4/es/api/form/PDFRadioGroup.d.ts +253 -0
  1423. package/ts3.4/es/api/form/PDFSignature.d.ts +30 -0
  1424. package/ts3.4/es/api/form/PDFTextField.d.ts +538 -0
  1425. package/ts3.4/es/api/form/appearances.d.ts +42 -0
  1426. package/ts3.4/es/api/form/index.d.ts +11 -0
  1427. package/ts3.4/es/api/image/alignment.d.ts +6 -0
  1428. package/ts3.4/es/api/image/index.d.ts +2 -0
  1429. package/ts3.4/es/api/index.d.ts +21 -0
  1430. package/ts3.4/es/api/objects.d.ts +5 -0
  1431. package/ts3.4/es/api/operations.d.ts +212 -0
  1432. package/ts3.4/es/api/operators.d.ts +86 -0
  1433. package/ts3.4/es/api/rotations.d.ts +39 -0
  1434. package/ts3.4/es/api/sizes.d.ts +53 -0
  1435. package/ts3.4/es/api/svgPath.d.ts +3 -0
  1436. package/ts3.4/es/api/text/alignment.d.ts +6 -0
  1437. package/ts3.4/es/api/text/index.d.ts +3 -0
  1438. package/ts3.4/es/api/text/layout.d.ts +55 -0
  1439. package/ts3.4/es/core/PDFContext.d.ts +84 -0
  1440. package/ts3.4/es/core/PDFObjectCopier.d.ts +38 -0
  1441. package/ts3.4/es/core/acroform/PDFAcroButton.d.ts +22 -0
  1442. package/ts3.4/es/core/acroform/PDFAcroCheckBox.d.ts +14 -0
  1443. package/ts3.4/es/core/acroform/PDFAcroChoice.d.ts +21 -0
  1444. package/ts3.4/es/core/acroform/PDFAcroComboBox.d.ts +10 -0
  1445. package/ts3.4/es/core/acroform/PDFAcroField.d.ts +37 -0
  1446. package/ts3.4/es/core/acroform/PDFAcroForm.d.ts +21 -0
  1447. package/ts3.4/es/core/acroform/PDFAcroListBox.d.ts +10 -0
  1448. package/ts3.4/es/core/acroform/PDFAcroNonTerminal.d.ts +14 -0
  1449. package/ts3.4/es/core/acroform/PDFAcroPushButton.d.ts +10 -0
  1450. package/ts3.4/es/core/acroform/PDFAcroRadioButton.d.ts +14 -0
  1451. package/ts3.4/es/core/acroform/PDFAcroSignature.d.ts +8 -0
  1452. package/ts3.4/es/core/acroform/PDFAcroTerminal.d.ts +17 -0
  1453. package/ts3.4/es/core/acroform/PDFAcroText.d.ts +23 -0
  1454. package/ts3.4/es/core/acroform/flags.d.ts +142 -0
  1455. package/ts3.4/es/core/acroform/index.d.ts +16 -0
  1456. package/ts3.4/es/core/acroform/utils.d.ts +7 -0
  1457. package/ts3.4/es/core/annotation/AppearanceCharacteristics.d.ts +34 -0
  1458. package/ts3.4/es/core/annotation/BorderStyle.d.ts +12 -0
  1459. package/ts3.4/es/core/annotation/PDFAnnotation.d.ts +52 -0
  1460. package/ts3.4/es/core/annotation/PDFWidgetAnnotation.d.ts +27 -0
  1461. package/ts3.4/es/core/annotation/flags.d.ts +80 -0
  1462. package/ts3.4/es/core/annotation/index.d.ts +5 -0
  1463. package/ts3.4/es/core/document/PDFCrossRefSection.d.ts +28 -0
  1464. package/ts3.4/es/core/document/PDFHeader.d.ts +11 -0
  1465. package/ts3.4/es/core/document/PDFTrailer.d.ts +10 -0
  1466. package/ts3.4/es/core/document/PDFTrailerDict.d.ts +11 -0
  1467. package/ts3.4/es/core/embedders/CMap.d.ts +4 -0
  1468. package/ts3.4/es/core/embedders/CustomFontEmbedder.d.ts +45 -0
  1469. package/ts3.4/es/core/embedders/CustomFontSubsetEmbedder.d.ts +21 -0
  1470. package/ts3.4/es/core/embedders/FileEmbedder.d.ts +34 -0
  1471. package/ts3.4/es/core/embedders/FontFlags.d.ts +14 -0
  1472. package/ts3.4/es/core/embedders/JavaScriptEmbedder.d.ts +11 -0
  1473. package/ts3.4/es/core/embedders/JpegEmbedder.d.ts +24 -0
  1474. package/ts3.4/es/core/embedders/PDFPageEmbedder.d.ts +38 -0
  1475. package/ts3.4/es/core/embedders/PngEmbedder.d.ts +20 -0
  1476. package/ts3.4/es/core/embedders/StandardFontEmbedder.d.ts +37 -0
  1477. package/ts3.4/es/core/errors.d.ts +92 -0
  1478. package/ts3.4/es/core/index.d.ts +48 -0
  1479. package/ts3.4/es/core/interactive/ViewerPreferences.d.ts +348 -0
  1480. package/ts3.4/es/core/objects/PDFArray.d.ts +64 -0
  1481. package/ts3.4/es/core/objects/PDFBool.d.ts +14 -0
  1482. package/ts3.4/es/core/objects/PDFDict.d.ts +62 -0
  1483. package/ts3.4/es/core/objects/PDFHexString.d.ts +17 -0
  1484. package/ts3.4/es/core/objects/PDFInvalidObject.d.ts +12 -0
  1485. package/ts3.4/es/core/objects/PDFName.d.ts +42 -0
  1486. package/ts3.4/es/core/objects/PDFNull.d.ts +11 -0
  1487. package/ts3.4/es/core/objects/PDFNumber.d.ts +16 -0
  1488. package/ts3.4/es/core/objects/PDFObject.d.ts +9 -0
  1489. package/ts3.4/es/core/objects/PDFRawStream.d.ts +15 -0
  1490. package/ts3.4/es/core/objects/PDFRef.d.ts +14 -0
  1491. package/ts3.4/es/core/objects/PDFStream.d.ts +17 -0
  1492. package/ts3.4/es/core/objects/PDFString.d.ts +17 -0
  1493. package/ts3.4/es/core/operators/PDFOperator.d.ts +20 -0
  1494. package/ts3.4/es/core/operators/PDFOperatorNames.d.ts +77 -0
  1495. package/ts3.4/es/core/parser/BaseParser.d.ts +15 -0
  1496. package/ts3.4/es/core/parser/ByteStream.d.ts +27 -0
  1497. package/ts3.4/es/core/parser/PDFObjectParser.d.ts +30 -0
  1498. package/ts3.4/es/core/parser/PDFObjectStreamParser.d.ts +14 -0
  1499. package/ts3.4/es/core/parser/PDFParser.d.ts +46 -0
  1500. package/ts3.4/es/core/parser/PDFXRefStreamParser.d.ts +22 -0
  1501. package/ts3.4/es/core/streams/Ascii85Stream.d.ts +10 -0
  1502. package/ts3.4/es/core/streams/AsciiHexStream.d.ts +10 -0
  1503. package/ts3.4/es/core/streams/DecodeStream.d.ts +27 -0
  1504. package/ts3.4/es/core/streams/FlateStream.d.ts +14 -0
  1505. package/ts3.4/es/core/streams/LZWStream.d.ts +13 -0
  1506. package/ts3.4/es/core/streams/RunLengthStream.d.ts +9 -0
  1507. package/ts3.4/es/core/streams/Stream.d.ts +35 -0
  1508. package/ts3.4/es/core/streams/decode.d.ts +4 -0
  1509. package/ts3.4/es/core/structures/PDFCatalog.d.ts +28 -0
  1510. package/ts3.4/es/core/structures/PDFContentStream.d.ts +16 -0
  1511. package/ts3.4/es/core/structures/PDFCrossRefStream.d.ts +54 -0
  1512. package/ts3.4/es/core/structures/PDFFlateStream.d.ts +14 -0
  1513. package/ts3.4/es/core/structures/PDFObjectStream.d.ts +21 -0
  1514. package/ts3.4/es/core/structures/PDFPageLeaf.d.ts +55 -0
  1515. package/ts3.4/es/core/structures/PDFPageTree.d.ts +42 -0
  1516. package/ts3.4/es/core/syntax/CharCodes.d.ts +62 -0
  1517. package/ts3.4/es/core/syntax/Delimiters.d.ts +2 -0
  1518. package/ts3.4/es/core/syntax/Irregular.d.ts +2 -0
  1519. package/ts3.4/es/core/syntax/Keywords.d.ts +23 -0
  1520. package/ts3.4/es/core/syntax/Numeric.d.ts +4 -0
  1521. package/ts3.4/es/core/syntax/Whitespace.d.ts +2 -0
  1522. package/ts3.4/es/core/writers/PDFStreamWriter.d.ts +20 -0
  1523. package/ts3.4/es/core/writers/PDFWriter.d.ts +30 -0
  1524. package/ts3.4/es/index.d.ts +5 -0
  1525. package/ts3.4/es/types/fontkit.d.ts +598 -0
  1526. package/ts3.4/es/types/index.d.ts +2 -0
  1527. package/ts3.4/es/types/matrix.d.ts +22 -0
  1528. package/ts3.4/es/utils/Cache.d.ts +11 -0
  1529. package/ts3.4/es/utils/arrays.d.ts +16 -0
  1530. package/ts3.4/es/utils/async.d.ts +6 -0
  1531. package/ts3.4/es/utils/base64.d.ts +11 -0
  1532. package/ts3.4/es/utils/errors.d.ts +2 -0
  1533. package/ts3.4/es/utils/index.d.ts +12 -0
  1534. package/ts3.4/es/utils/numbers.d.ts +24 -0
  1535. package/ts3.4/es/utils/objects.d.ts +16 -0
  1536. package/ts3.4/es/utils/pdfDocEncoding.d.ts +8 -0
  1537. package/ts3.4/es/utils/png.d.ts +18 -0
  1538. package/ts3.4/es/utils/rng.d.ts +14 -0
  1539. package/ts3.4/es/utils/strings.d.ts +25 -0
  1540. package/ts3.4/es/utils/unicode.d.ts +187 -0
  1541. package/ts3.4/es/utils/validators.d.ts +27 -0
  1542. package/yarn.lock +4408 -0
@@ -0,0 +1,1442 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var colors_1 = require("./colors");
5
+ var operations_1 = require("./operations");
6
+ var operators_1 = require("./operators");
7
+ var PDFDocument_1 = tslib_1.__importDefault(require("./PDFDocument"));
8
+ var PDFEmbeddedPage_1 = tslib_1.__importDefault(require("./PDFEmbeddedPage"));
9
+ var PDFFont_1 = tslib_1.__importDefault(require("./PDFFont"));
10
+ var PDFImage_1 = tslib_1.__importDefault(require("./PDFImage"));
11
+ var PDFPageOptions_1 = require("./PDFPageOptions");
12
+ var rotations_1 = require("./rotations");
13
+ var StandardFonts_1 = require("./StandardFonts");
14
+ var core_1 = require("../core");
15
+ var utils_1 = require("../utils");
16
+ /**
17
+ * Represents a single page of a [[PDFDocument]].
18
+ */
19
+ var PDFPage = /** @class */ (function () {
20
+ function PDFPage(leafNode, ref, doc) {
21
+ this.fontSize = 24;
22
+ this.fontColor = colors_1.rgb(0, 0, 0);
23
+ this.lineHeight = 24;
24
+ this.x = 0;
25
+ this.y = 0;
26
+ utils_1.assertIs(leafNode, 'leafNode', [[core_1.PDFPageLeaf, 'PDFPageLeaf']]);
27
+ utils_1.assertIs(ref, 'ref', [[core_1.PDFRef, 'PDFRef']]);
28
+ utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]);
29
+ this.node = leafNode;
30
+ this.ref = ref;
31
+ this.doc = doc;
32
+ }
33
+ /**
34
+ * Rotate this page by a multiple of 90 degrees. For example:
35
+ * ```js
36
+ * import { degrees } from 'pdf-lib'
37
+ *
38
+ * page.setRotation(degrees(-90))
39
+ * page.setRotation(degrees(0))
40
+ * page.setRotation(degrees(90))
41
+ * page.setRotation(degrees(180))
42
+ * page.setRotation(degrees(270))
43
+ * ```
44
+ * @param angle The angle to rotate this page.
45
+ */
46
+ PDFPage.prototype.setRotation = function (angle) {
47
+ var degreesAngle = rotations_1.toDegrees(angle);
48
+ utils_1.assertMultiple(degreesAngle, 'degreesAngle', 90);
49
+ this.node.set(core_1.PDFName.of('Rotate'), this.doc.context.obj(degreesAngle));
50
+ };
51
+ /**
52
+ * Get this page's rotation angle in degrees. For example:
53
+ * ```js
54
+ * const rotationAngle = page.getRotation().angle;
55
+ * ```
56
+ * @returns The rotation angle of the page in degrees (always a multiple of
57
+ * 90 degrees).
58
+ */
59
+ PDFPage.prototype.getRotation = function () {
60
+ var Rotate = this.node.Rotate();
61
+ return rotations_1.degrees(Rotate ? Rotate.asNumber() : 0);
62
+ };
63
+ /**
64
+ * Resize this page by increasing or decreasing its width and height. For
65
+ * example:
66
+ * ```js
67
+ * page.setSize(250, 500)
68
+ * page.setSize(page.getWidth() + 50, page.getHeight() + 100)
69
+ * page.setSize(page.getWidth() - 50, page.getHeight() - 100)
70
+ * ```
71
+ *
72
+ * Note that the PDF specification does not allow for pages to have explicit
73
+ * widths and heights. Instead it defines the "size" of a page in terms of
74
+ * five rectangles: the MediaBox, CropBox, BleedBox, TrimBox, and ArtBox. As a
75
+ * result, this method cannot directly change the width and height of a page.
76
+ * Instead, it works by adjusting these five boxes.
77
+ *
78
+ * This method performs the following steps:
79
+ * 1. Set width & height of MediaBox.
80
+ * 2. Set width & height of CropBox, if it has same dimensions as MediaBox.
81
+ * 3. Set width & height of BleedBox, if it has same dimensions as MediaBox.
82
+ * 4. Set width & height of TrimBox, if it has same dimensions as MediaBox.
83
+ * 5. Set width & height of ArtBox, if it has same dimensions as MediaBox.
84
+ *
85
+ * This approach works well for most PDF documents as all PDF pages must
86
+ * have a MediaBox, but relatively few have a CropBox, BleedBox, TrimBox, or
87
+ * ArtBox. And when they do have these additional boxes, they often have the
88
+ * same dimensions as the MediaBox. However, if you find this method does not
89
+ * work for your document, consider setting the boxes directly:
90
+ * * [[PDFPage.setMediaBox]]
91
+ * * [[PDFPage.setCropBox]]
92
+ * * [[PDFPage.setBleedBox]]
93
+ * * [[PDFPage.setTrimBox]]
94
+ * * [[PDFPage.setArtBox]]
95
+ *
96
+ * @param width The new width of the page.
97
+ * @param height The new height of the page.
98
+ */
99
+ PDFPage.prototype.setSize = function (width, height) {
100
+ utils_1.assertIs(width, 'width', ['number']);
101
+ utils_1.assertIs(height, 'height', ['number']);
102
+ var mediaBox = this.getMediaBox();
103
+ this.setMediaBox(mediaBox.x, mediaBox.y, width, height);
104
+ var cropBox = this.getCropBox();
105
+ var bleedBox = this.getBleedBox();
106
+ var trimBox = this.getTrimBox();
107
+ var artBox = this.getArtBox();
108
+ var hasCropBox = this.node.CropBox();
109
+ var hasBleedBox = this.node.BleedBox();
110
+ var hasTrimBox = this.node.TrimBox();
111
+ var hasArtBox = this.node.ArtBox();
112
+ if (hasCropBox && utils_1.rectanglesAreEqual(cropBox, mediaBox)) {
113
+ this.setCropBox(mediaBox.x, mediaBox.y, width, height);
114
+ }
115
+ if (hasBleedBox && utils_1.rectanglesAreEqual(bleedBox, mediaBox)) {
116
+ this.setBleedBox(mediaBox.x, mediaBox.y, width, height);
117
+ }
118
+ if (hasTrimBox && utils_1.rectanglesAreEqual(trimBox, mediaBox)) {
119
+ this.setTrimBox(mediaBox.x, mediaBox.y, width, height);
120
+ }
121
+ if (hasArtBox && utils_1.rectanglesAreEqual(artBox, mediaBox)) {
122
+ this.setArtBox(mediaBox.x, mediaBox.y, width, height);
123
+ }
124
+ };
125
+ /**
126
+ * Resize this page by increasing or decreasing its width. For example:
127
+ * ```js
128
+ * page.setWidth(250)
129
+ * page.setWidth(page.getWidth() + 50)
130
+ * page.setWidth(page.getWidth() - 50)
131
+ * ```
132
+ *
133
+ * This method uses [[PDFPage.setSize]] to set the page's width.
134
+ *
135
+ * @param width The new width of the page.
136
+ */
137
+ PDFPage.prototype.setWidth = function (width) {
138
+ utils_1.assertIs(width, 'width', ['number']);
139
+ this.setSize(width, this.getSize().height);
140
+ };
141
+ /**
142
+ * Resize this page by increasing or decreasing its height. For example:
143
+ * ```js
144
+ * page.setHeight(500)
145
+ * page.setHeight(page.getWidth() + 100)
146
+ * page.setHeight(page.getWidth() - 100)
147
+ * ```
148
+ *
149
+ * This method uses [[PDFPage.setSize]] to set the page's height.
150
+ *
151
+ * @param height The new height of the page.
152
+ */
153
+ PDFPage.prototype.setHeight = function (height) {
154
+ utils_1.assertIs(height, 'height', ['number']);
155
+ this.setSize(this.getSize().width, height);
156
+ };
157
+ /**
158
+ * Set the MediaBox of this page. For example:
159
+ * ```js
160
+ * const mediaBox = page.getMediaBox()
161
+ *
162
+ * page.setMediaBox(0, 0, 250, 500)
163
+ * page.setMediaBox(mediaBox.x, mediaBox.y, 50, 100)
164
+ * page.setMediaBox(15, 5, mediaBox.width - 50, mediaBox.height - 100)
165
+ * ```
166
+ *
167
+ * See [[PDFPage.getMediaBox]] for details about what the MediaBox represents.
168
+ *
169
+ * @param x The x coordinate of the lower left corner of the new MediaBox.
170
+ * @param y The y coordinate of the lower left corner of the new MediaBox.
171
+ * @param width The width of the new MediaBox.
172
+ * @param height The height of the new MediaBox.
173
+ */
174
+ PDFPage.prototype.setMediaBox = function (x, y, width, height) {
175
+ utils_1.assertIs(x, 'x', ['number']);
176
+ utils_1.assertIs(y, 'y', ['number']);
177
+ utils_1.assertIs(width, 'width', ['number']);
178
+ utils_1.assertIs(height, 'height', ['number']);
179
+ var mediaBox = this.doc.context.obj([x, y, x + width, y + height]);
180
+ this.node.set(core_1.PDFName.MediaBox, mediaBox);
181
+ };
182
+ /**
183
+ * Set the CropBox of this page. For example:
184
+ * ```js
185
+ * const cropBox = page.getCropBox()
186
+ *
187
+ * page.setCropBox(0, 0, 250, 500)
188
+ * page.setCropBox(cropBox.x, cropBox.y, 50, 100)
189
+ * page.setCropBox(15, 5, cropBox.width - 50, cropBox.height - 100)
190
+ * ```
191
+ *
192
+ * See [[PDFPage.getCropBox]] for details about what the CropBox represents.
193
+ *
194
+ * @param x The x coordinate of the lower left corner of the new CropBox.
195
+ * @param y The y coordinate of the lower left corner of the new CropBox.
196
+ * @param width The width of the new CropBox.
197
+ * @param height The height of the new CropBox.
198
+ */
199
+ PDFPage.prototype.setCropBox = function (x, y, width, height) {
200
+ utils_1.assertIs(x, 'x', ['number']);
201
+ utils_1.assertIs(y, 'y', ['number']);
202
+ utils_1.assertIs(width, 'width', ['number']);
203
+ utils_1.assertIs(height, 'height', ['number']);
204
+ var cropBox = this.doc.context.obj([x, y, x + width, y + height]);
205
+ this.node.set(core_1.PDFName.CropBox, cropBox);
206
+ };
207
+ /**
208
+ * Set the BleedBox of this page. For example:
209
+ * ```js
210
+ * const bleedBox = page.getBleedBox()
211
+ *
212
+ * page.setBleedBox(0, 0, 250, 500)
213
+ * page.setBleedBox(bleedBox.x, bleedBox.y, 50, 100)
214
+ * page.setBleedBox(15, 5, bleedBox.width - 50, bleedBox.height - 100)
215
+ * ```
216
+ *
217
+ * See [[PDFPage.getBleedBox]] for details about what the BleedBox represents.
218
+ *
219
+ * @param x The x coordinate of the lower left corner of the new BleedBox.
220
+ * @param y The y coordinate of the lower left corner of the new BleedBox.
221
+ * @param width The width of the new BleedBox.
222
+ * @param height The height of the new BleedBox.
223
+ */
224
+ PDFPage.prototype.setBleedBox = function (x, y, width, height) {
225
+ utils_1.assertIs(x, 'x', ['number']);
226
+ utils_1.assertIs(y, 'y', ['number']);
227
+ utils_1.assertIs(width, 'width', ['number']);
228
+ utils_1.assertIs(height, 'height', ['number']);
229
+ var bleedBox = this.doc.context.obj([x, y, x + width, y + height]);
230
+ this.node.set(core_1.PDFName.BleedBox, bleedBox);
231
+ };
232
+ /**
233
+ * Set the TrimBox of this page. For example:
234
+ * ```js
235
+ * const trimBox = page.getTrimBox()
236
+ *
237
+ * page.setTrimBox(0, 0, 250, 500)
238
+ * page.setTrimBox(trimBox.x, trimBox.y, 50, 100)
239
+ * page.setTrimBox(15, 5, trimBox.width - 50, trimBox.height - 100)
240
+ * ```
241
+ *
242
+ * See [[PDFPage.getTrimBox]] for details about what the TrimBox represents.
243
+ *
244
+ * @param x The x coordinate of the lower left corner of the new TrimBox.
245
+ * @param y The y coordinate of the lower left corner of the new TrimBox.
246
+ * @param width The width of the new TrimBox.
247
+ * @param height The height of the new TrimBox.
248
+ */
249
+ PDFPage.prototype.setTrimBox = function (x, y, width, height) {
250
+ utils_1.assertIs(x, 'x', ['number']);
251
+ utils_1.assertIs(y, 'y', ['number']);
252
+ utils_1.assertIs(width, 'width', ['number']);
253
+ utils_1.assertIs(height, 'height', ['number']);
254
+ var trimBox = this.doc.context.obj([x, y, x + width, y + height]);
255
+ this.node.set(core_1.PDFName.TrimBox, trimBox);
256
+ };
257
+ /**
258
+ * Set the ArtBox of this page. For example:
259
+ * ```js
260
+ * const artBox = page.getArtBox()
261
+ *
262
+ * page.setArtBox(0, 0, 250, 500)
263
+ * page.setArtBox(artBox.x, artBox.y, 50, 100)
264
+ * page.setArtBox(15, 5, artBox.width - 50, artBox.height - 100)
265
+ * ```
266
+ *
267
+ * See [[PDFPage.getArtBox]] for details about what the ArtBox represents.
268
+ *
269
+ * @param x The x coordinate of the lower left corner of the new ArtBox.
270
+ * @param y The y coordinate of the lower left corner of the new ArtBox.
271
+ * @param width The width of the new ArtBox.
272
+ * @param height The height of the new ArtBox.
273
+ */
274
+ PDFPage.prototype.setArtBox = function (x, y, width, height) {
275
+ utils_1.assertIs(x, 'x', ['number']);
276
+ utils_1.assertIs(y, 'y', ['number']);
277
+ utils_1.assertIs(width, 'width', ['number']);
278
+ utils_1.assertIs(height, 'height', ['number']);
279
+ var artBox = this.doc.context.obj([x, y, x + width, y + height]);
280
+ this.node.set(core_1.PDFName.ArtBox, artBox);
281
+ };
282
+ /**
283
+ * Get this page's width and height. For example:
284
+ * ```js
285
+ * const { width, height } = page.getSize()
286
+ * ```
287
+ *
288
+ * This method uses [[PDFPage.getMediaBox]] to obtain the page's
289
+ * width and height.
290
+ *
291
+ * @returns The width and height of the page.
292
+ */
293
+ PDFPage.prototype.getSize = function () {
294
+ var _a = this.getMediaBox(), width = _a.width, height = _a.height;
295
+ return { width: width, height: height };
296
+ };
297
+ /**
298
+ * Get this page's width. For example:
299
+ * ```js
300
+ * const width = page.getWidth()
301
+ * ```
302
+ *
303
+ * This method uses [[PDFPage.getSize]] to obtain the page's size.
304
+ *
305
+ * @returns The width of the page.
306
+ */
307
+ PDFPage.prototype.getWidth = function () {
308
+ return this.getSize().width;
309
+ };
310
+ /**
311
+ * Get this page's height. For example:
312
+ * ```js
313
+ * const height = page.getHeight()
314
+ * ```
315
+ *
316
+ * This method uses [[PDFPage.getSize]] to obtain the page's size.
317
+ *
318
+ * @returns The height of the page.
319
+ */
320
+ PDFPage.prototype.getHeight = function () {
321
+ return this.getSize().height;
322
+ };
323
+ /**
324
+ * Get the rectangle defining this page's MediaBox. For example:
325
+ * ```js
326
+ * const { x, y, width, height } = page.getMediaBox()
327
+ * ```
328
+ *
329
+ * The MediaBox of a page defines the boundaries of the physical medium on
330
+ * which the page is to be displayed/printed. It may include extended area
331
+ * surrounding the page content for bleed marks, printing marks, etc...
332
+ * It may also include areas close to the edges of the medium that cannot be
333
+ * marked because of physical limitations of the output device. Content
334
+ * falling outside this boundary may safely be discarded without affecting
335
+ * the meaning of the PDF file.
336
+ *
337
+ * @returns An object defining the lower left corner of the MediaBox and its
338
+ * width & height.
339
+ */
340
+ PDFPage.prototype.getMediaBox = function () {
341
+ var mediaBox = this.node.MediaBox();
342
+ return mediaBox.asRectangle();
343
+ };
344
+ /**
345
+ * Get the rectangle defining this page's CropBox. For example:
346
+ * ```js
347
+ * const { x, y, width, height } = page.getCropBox()
348
+ * ```
349
+ *
350
+ * The CropBox of a page defines the region to which the contents of the page
351
+ * shall be clipped when displayed or printed. Unlike the other boxes, the
352
+ * CropBox does not necessarily represent the physical page geometry. It
353
+ * merely imposes clipping on the page contents.
354
+ *
355
+ * The CropBox's default value is the page's MediaBox.
356
+ *
357
+ * @returns An object defining the lower left corner of the CropBox and its
358
+ * width & height.
359
+ */
360
+ PDFPage.prototype.getCropBox = function () {
361
+ var _a;
362
+ var cropBox = this.node.CropBox();
363
+ return (_a = cropBox === null || cropBox === void 0 ? void 0 : cropBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getMediaBox();
364
+ };
365
+ /**
366
+ * Get the rectangle defining this page's BleedBox. For example:
367
+ * ```js
368
+ * const { x, y, width, height } = page.getBleedBox()
369
+ * ```
370
+ *
371
+ * The BleedBox of a page defines the region to which the contents of the
372
+ * page shall be clipped when output in a production environment. This may
373
+ * include any extra bleed area needed to accommodate the physical
374
+ * limitations of cutting, folding, and trimming equipment. The actual
375
+ * printed page may include printing marks that fall outside the BleedBox.
376
+ *
377
+ * The BleedBox's default value is the page's CropBox.
378
+ *
379
+ * @returns An object defining the lower left corner of the BleedBox and its
380
+ * width & height.
381
+ */
382
+ PDFPage.prototype.getBleedBox = function () {
383
+ var _a;
384
+ var bleedBox = this.node.BleedBox();
385
+ return (_a = bleedBox === null || bleedBox === void 0 ? void 0 : bleedBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
386
+ };
387
+ /**
388
+ * Get the rectangle defining this page's TrimBox. For example:
389
+ * ```js
390
+ * const { x, y, width, height } = page.getTrimBox()
391
+ * ```
392
+ *
393
+ * The TrimBox of a page defines the intended dimensions of the finished
394
+ * page after trimming. It may be smaller than the MediaBox to allow for
395
+ * production-related content, such as printing instructions, cut marks, or
396
+ * color bars.
397
+ *
398
+ * The TrimBox's default value is the page's CropBox.
399
+ *
400
+ * @returns An object defining the lower left corner of the TrimBox and its
401
+ * width & height.
402
+ */
403
+ PDFPage.prototype.getTrimBox = function () {
404
+ var _a;
405
+ var trimBox = this.node.TrimBox();
406
+ return (_a = trimBox === null || trimBox === void 0 ? void 0 : trimBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
407
+ };
408
+ /**
409
+ * Get the rectangle defining this page's ArtBox. For example:
410
+ * ```js
411
+ * const { x, y, width, height } = page.getArtBox()
412
+ * ```
413
+ *
414
+ * The ArtBox of a page defines the extent of the page's meaningful content
415
+ * (including potential white space).
416
+ *
417
+ * The ArtBox's default value is the page's CropBox.
418
+ *
419
+ * @returns An object defining the lower left corner of the ArtBox and its
420
+ * width & height.
421
+ */
422
+ PDFPage.prototype.getArtBox = function () {
423
+ var _a;
424
+ var artBox = this.node.ArtBox();
425
+ return (_a = artBox === null || artBox === void 0 ? void 0 : artBox.asRectangle()) !== null && _a !== void 0 ? _a : this.getCropBox();
426
+ };
427
+ /**
428
+ * Translate this page's content to a new location on the page. This operation
429
+ * is often useful after resizing the page with [[setSize]]. For example:
430
+ * ```js
431
+ * // Add 50 units of whitespace to the top and right of the page
432
+ * page.setSize(page.getWidth() + 50, page.getHeight() + 50)
433
+ *
434
+ * // Move the page's content from the lower-left corner of the page
435
+ * // to the top-right corner.
436
+ * page.translateContent(50, 50)
437
+ *
438
+ * // Now there are 50 units of whitespace to the left and bottom of the page
439
+ * ```
440
+ * See also: [[resetPosition]]
441
+ * @param x The new position on the x-axis for this page's content.
442
+ * @param y The new position on the y-axis for this page's content.
443
+ */
444
+ PDFPage.prototype.translateContent = function (x, y) {
445
+ utils_1.assertIs(x, 'x', ['number']);
446
+ utils_1.assertIs(y, 'y', ['number']);
447
+ this.node.normalize();
448
+ this.getContentStream();
449
+ var start = this.createContentStream(operators_1.pushGraphicsState(), operators_1.translate(x, y));
450
+ var startRef = this.doc.context.register(start);
451
+ var end = this.createContentStream(operators_1.popGraphicsState());
452
+ var endRef = this.doc.context.register(end);
453
+ this.node.wrapContentStreams(startRef, endRef);
454
+ };
455
+ /**
456
+ * Scale the size, content, and annotations of a page.
457
+ *
458
+ * For example:
459
+ * ```js
460
+ * page.scale(0.5, 0.5);
461
+ * ```
462
+ *
463
+ * @param x The factor by which the width for the page should be scaled
464
+ * (e.g. `0.5` is 50%).
465
+ * @param y The factor by which the height for the page should be scaled
466
+ * (e.g. `2.0` is 200%).
467
+ */
468
+ PDFPage.prototype.scale = function (x, y) {
469
+ utils_1.assertIs(x, 'x', ['number']);
470
+ utils_1.assertIs(y, 'y', ['number']);
471
+ this.setSize(this.getWidth() * x, this.getHeight() * y);
472
+ this.scaleContent(x, y);
473
+ this.scaleAnnotations(x, y);
474
+ };
475
+ /**
476
+ * Scale the content of a page. This is useful after resizing an existing
477
+ * page. This scales only the content, not the annotations.
478
+ *
479
+ * For example:
480
+ * ```js
481
+ * // Bisect the size of the page
482
+ * page.setSize(page.getWidth() / 2, page.getHeight() / 2);
483
+ *
484
+ * // Scale the content of the page down by 50% in x and y
485
+ * page.scaleContent(0.5, 0.5);
486
+ * ```
487
+ * See also: [[scaleAnnotations]]
488
+ * @param x The factor by which the x-axis for the content should be scaled
489
+ * (e.g. `0.5` is 50%).
490
+ * @param y The factor by which the y-axis for the content should be scaled
491
+ * (e.g. `2.0` is 200%).
492
+ */
493
+ PDFPage.prototype.scaleContent = function (x, y) {
494
+ utils_1.assertIs(x, 'x', ['number']);
495
+ utils_1.assertIs(y, 'y', ['number']);
496
+ this.node.normalize();
497
+ this.getContentStream();
498
+ var start = this.createContentStream(operators_1.pushGraphicsState(), operators_1.scale(x, y));
499
+ var startRef = this.doc.context.register(start);
500
+ var end = this.createContentStream(operators_1.popGraphicsState());
501
+ var endRef = this.doc.context.register(end);
502
+ this.node.wrapContentStreams(startRef, endRef);
503
+ };
504
+ /**
505
+ * Scale the annotations of a page. This is useful if you want to scale a
506
+ * page with comments or other annotations.
507
+ * ```js
508
+ * // Scale the content of the page down by 50% in x and y
509
+ * page.scaleContent(0.5, 0.5);
510
+ *
511
+ * // Scale the content of the page down by 50% in x and y
512
+ * page.scaleAnnotations(0.5, 0.5);
513
+ * ```
514
+ * See also: [[scaleContent]]
515
+ * @param x The factor by which the x-axis for the annotations should be
516
+ * scaled (e.g. `0.5` is 50%).
517
+ * @param y The factor by which the y-axis for the annotations should be
518
+ * scaled (e.g. `2.0` is 200%).
519
+ */
520
+ PDFPage.prototype.scaleAnnotations = function (x, y) {
521
+ utils_1.assertIs(x, 'x', ['number']);
522
+ utils_1.assertIs(y, 'y', ['number']);
523
+ var annots = this.node.Annots();
524
+ if (!annots)
525
+ return;
526
+ for (var idx = 0; idx < annots.size(); idx++) {
527
+ var annot = annots.lookup(idx);
528
+ if (annot instanceof core_1.PDFDict)
529
+ this.scaleAnnot(annot, x, y);
530
+ }
531
+ };
532
+ /**
533
+ * Reset the x and y coordinates of this page to `(0, 0)`. This operation is
534
+ * often useful after calling [[translateContent]]. For example:
535
+ * ```js
536
+ * // Shift the page's contents up and to the right by 50 units
537
+ * page.translateContent(50, 50)
538
+ *
539
+ * // This text will shifted - it will be drawn at (50, 50)
540
+ * page.drawText('I am shifted')
541
+ *
542
+ * // Move back to (0, 0)
543
+ * page.resetPosition()
544
+ *
545
+ * // This text will not be shifted - it will be drawn at (0, 0)
546
+ * page.drawText('I am not shifted')
547
+ * ```
548
+ */
549
+ PDFPage.prototype.resetPosition = function () {
550
+ this.getContentStream(false);
551
+ this.x = 0;
552
+ this.y = 0;
553
+ };
554
+ /**
555
+ * Choose a default font for this page. The default font will be used whenever
556
+ * text is drawn on this page and no font is specified. For example:
557
+ * ```js
558
+ * import { StandardFonts } from 'pdf-lib'
559
+ *
560
+ * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
561
+ * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)
562
+ * const courierFont = await pdfDoc.embedFont(StandardFonts.Courier)
563
+ *
564
+ * const page = pdfDoc.addPage()
565
+ *
566
+ * page.setFont(helveticaFont)
567
+ * page.drawText('I will be drawn in Helvetica')
568
+ *
569
+ * page.setFont(timesRomanFont)
570
+ * page.drawText('I will be drawn in Courier', { font: courierFont })
571
+ * ```
572
+ * @param font The default font to be used when drawing text on this page.
573
+ */
574
+ PDFPage.prototype.setFont = function (font) {
575
+ // TODO: Reuse image Font name if we've already added this image to Resources.Fonts
576
+ utils_1.assertIs(font, 'font', [[PDFFont_1.default, 'PDFFont']]);
577
+ this.font = font;
578
+ this.fontKey = this.node.newFontDictionary(this.font.name, this.font.ref);
579
+ };
580
+ /**
581
+ * Choose a default font size for this page. The default font size will be
582
+ * used whenever text is drawn on this page and no font size is specified.
583
+ * For example:
584
+ * ```js
585
+ * page.setFontSize(12)
586
+ * page.drawText('I will be drawn in size 12')
587
+ *
588
+ * page.setFontSize(36)
589
+ * page.drawText('I will be drawn in size 24', { fontSize: 24 })
590
+ * ```
591
+ * @param fontSize The default font size to be used when drawing text on this
592
+ * page.
593
+ */
594
+ PDFPage.prototype.setFontSize = function (fontSize) {
595
+ utils_1.assertIs(fontSize, 'fontSize', ['number']);
596
+ this.fontSize = fontSize;
597
+ };
598
+ /**
599
+ * Choose a default font color for this page. The default font color will be
600
+ * used whenever text is drawn on this page and no font color is specified.
601
+ * For example:
602
+ * ```js
603
+ * import { rgb, cmyk, grayscale } from 'pdf-lib'
604
+ *
605
+ * page.setFontColor(rgb(0.97, 0.02, 0.97))
606
+ * page.drawText('I will be drawn in pink')
607
+ *
608
+ * page.setFontColor(cmyk(0.4, 0.7, 0.39, 0.15))
609
+ * page.drawText('I will be drawn in gray', { color: grayscale(0.5) })
610
+ * ```
611
+ * @param fontColor The default font color to be used when drawing text on
612
+ * this page.
613
+ */
614
+ PDFPage.prototype.setFontColor = function (fontColor) {
615
+ utils_1.assertIs(fontColor, 'fontColor', [[Object, 'Color']]);
616
+ this.fontColor = fontColor;
617
+ };
618
+ /**
619
+ * Choose a default line height for this page. The default line height will be
620
+ * used whenever text is drawn on this page and no line height is specified.
621
+ * For example:
622
+ * ```js
623
+ * page.setLineHeight(12);
624
+ * page.drawText('These lines will be vertically \n separated by 12 units')
625
+ *
626
+ * page.setLineHeight(36);
627
+ * page.drawText('These lines will be vertically \n separated by 24 units', {
628
+ * lineHeight: 24
629
+ * })
630
+ * ```
631
+ * @param lineHeight The default line height to be used when drawing text on
632
+ * this page.
633
+ */
634
+ PDFPage.prototype.setLineHeight = function (lineHeight) {
635
+ utils_1.assertIs(lineHeight, 'lineHeight', ['number']);
636
+ this.lineHeight = lineHeight;
637
+ };
638
+ /**
639
+ * Get the default position of this page. For example:
640
+ * ```js
641
+ * const { x, y } = page.getPosition()
642
+ * ```
643
+ * @returns The default position of the page.
644
+ */
645
+ PDFPage.prototype.getPosition = function () {
646
+ return { x: this.x, y: this.y };
647
+ };
648
+ /**
649
+ * Get the default x coordinate of this page. For example:
650
+ * ```js
651
+ * const x = page.getX()
652
+ * ```
653
+ * @returns The default x coordinate of the page.
654
+ */
655
+ PDFPage.prototype.getX = function () {
656
+ return this.x;
657
+ };
658
+ /**
659
+ * Get the default y coordinate of this page. For example:
660
+ * ```js
661
+ * const y = page.getY()
662
+ * ```
663
+ * @returns The default y coordinate of the page.
664
+ */
665
+ PDFPage.prototype.getY = function () {
666
+ return this.y;
667
+ };
668
+ /**
669
+ * Change the default position of this page. For example:
670
+ * ```js
671
+ * page.moveTo(0, 0)
672
+ * page.drawText('I will be drawn at the origin')
673
+ *
674
+ * page.moveTo(0, 25)
675
+ * page.drawText('I will be drawn 25 units up')
676
+ *
677
+ * page.moveTo(25, 25)
678
+ * page.drawText('I will be drawn 25 units up and 25 units to the right')
679
+ * ```
680
+ * @param x The new default position on the x-axis for this page.
681
+ * @param y The new default position on the y-axis for this page.
682
+ */
683
+ PDFPage.prototype.moveTo = function (x, y) {
684
+ utils_1.assertIs(x, 'x', ['number']);
685
+ utils_1.assertIs(y, 'y', ['number']);
686
+ this.x = x;
687
+ this.y = y;
688
+ };
689
+ /**
690
+ * Change the default position of this page to be further down the y-axis.
691
+ * For example:
692
+ * ```js
693
+ * page.moveTo(50, 50)
694
+ * page.drawText('I will be drawn at (50, 50)')
695
+ *
696
+ * page.moveDown(10)
697
+ * page.drawText('I will be drawn at (50, 40)')
698
+ * ```
699
+ * @param yDecrease The amount by which the page's default position along the
700
+ * y-axis should be decreased.
701
+ */
702
+ PDFPage.prototype.moveDown = function (yDecrease) {
703
+ utils_1.assertIs(yDecrease, 'yDecrease', ['number']);
704
+ this.y -= yDecrease;
705
+ };
706
+ /**
707
+ * Change the default position of this page to be further up the y-axis.
708
+ * For example:
709
+ * ```js
710
+ * page.moveTo(50, 50)
711
+ * page.drawText('I will be drawn at (50, 50)')
712
+ *
713
+ * page.moveUp(10)
714
+ * page.drawText('I will be drawn at (50, 60)')
715
+ * ```
716
+ * @param yIncrease The amount by which the page's default position along the
717
+ * y-axis should be increased.
718
+ */
719
+ PDFPage.prototype.moveUp = function (yIncrease) {
720
+ utils_1.assertIs(yIncrease, 'yIncrease', ['number']);
721
+ this.y += yIncrease;
722
+ };
723
+ /**
724
+ * Change the default position of this page to be further left on the x-axis.
725
+ * For example:
726
+ * ```js
727
+ * page.moveTo(50, 50)
728
+ * page.drawText('I will be drawn at (50, 50)')
729
+ *
730
+ * page.moveLeft(10)
731
+ * page.drawText('I will be drawn at (40, 50)')
732
+ * ```
733
+ * @param xDecrease The amount by which the page's default position along the
734
+ * x-axis should be decreased.
735
+ */
736
+ PDFPage.prototype.moveLeft = function (xDecrease) {
737
+ utils_1.assertIs(xDecrease, 'xDecrease', ['number']);
738
+ this.x -= xDecrease;
739
+ };
740
+ /**
741
+ * Change the default position of this page to be further right on the y-axis.
742
+ * For example:
743
+ * ```js
744
+ * page.moveTo(50, 50)
745
+ * page.drawText('I will be drawn at (50, 50)')
746
+ *
747
+ * page.moveRight(10)
748
+ * page.drawText('I will be drawn at (60, 50)')
749
+ * ```
750
+ * @param xIncrease The amount by which the page's default position along the
751
+ * x-axis should be increased.
752
+ */
753
+ PDFPage.prototype.moveRight = function (xIncrease) {
754
+ utils_1.assertIs(xIncrease, 'xIncrease', ['number']);
755
+ this.x += xIncrease;
756
+ };
757
+ /**
758
+ * Push one or more operators to the end of this page's current content
759
+ * stream. For example:
760
+ * ```js
761
+ * import {
762
+ * pushGraphicsState,
763
+ * moveTo,
764
+ * lineTo,
765
+ * closePath,
766
+ * setFillingColor,
767
+ * rgb,
768
+ * fill,
769
+ * popGraphicsState,
770
+ * } from 'pdf-lib'
771
+ *
772
+ * // Draw a green triangle in the lower-left corner of the page
773
+ * page.pushOperators(
774
+ * pushGraphicsState(),
775
+ * moveTo(0, 0),
776
+ * lineTo(100, 0),
777
+ * lineTo(50, 100),
778
+ * closePath(),
779
+ * setFillingColor(rgb(0.0, 1.0, 0.0)),
780
+ * fill(),
781
+ * popGraphicsState(),
782
+ * )
783
+ * ```
784
+ * @param operator The operators to be pushed.
785
+ */
786
+ PDFPage.prototype.pushOperators = function () {
787
+ var operator = [];
788
+ for (var _i = 0; _i < arguments.length; _i++) {
789
+ operator[_i] = arguments[_i];
790
+ }
791
+ utils_1.assertEachIs(operator, 'operator', [[core_1.PDFOperator, 'PDFOperator']]);
792
+ var contentStream = this.getContentStream();
793
+ contentStream.push.apply(contentStream, operator);
794
+ };
795
+ /**
796
+ * Draw one or more lines of text on this page. For example:
797
+ * ```js
798
+ * import { StandardFonts, rgb } from 'pdf-lib'
799
+ *
800
+ * const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)
801
+ * const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
802
+ *
803
+ * const page = pdfDoc.addPage()
804
+ *
805
+ * page.setFont(helveticaFont)
806
+ *
807
+ * page.moveTo(5, 200)
808
+ * page.drawText('The Life of an Egg', { size: 36 })
809
+ *
810
+ * page.moveDown(36)
811
+ * page.drawText('An Epic Tale of Woe', { size: 30 })
812
+ *
813
+ * page.drawText(
814
+ * `Humpty Dumpty sat on a wall \n` +
815
+ * `Humpty Dumpty had a great fall; \n` +
816
+ * `All the king's horses and all the king's men \n` +
817
+ * `Couldn't put Humpty together again. \n`,
818
+ * {
819
+ * x: 25,
820
+ * y: 100,
821
+ * font: timesRomanFont,
822
+ * size: 24,
823
+ * color: rgb(1, 0, 0),
824
+ * lineHeight: 24,
825
+ * opacity: 0.75,
826
+ * },
827
+ * )
828
+ * ```
829
+ * @param text The text to be drawn.
830
+ * @param options The options to be used when drawing the text.
831
+ */
832
+ PDFPage.prototype.drawText = function (text, options) {
833
+ var _a, _b, _c, _d, _e, _f, _g;
834
+ if (options === void 0) { options = {}; }
835
+ utils_1.assertIs(text, 'text', ['string']);
836
+ utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
837
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
838
+ utils_1.assertOrUndefined(options.font, 'options.font', [[PDFFont_1.default, 'PDFFont']]);
839
+ utils_1.assertOrUndefined(options.size, 'options.size', ['number']);
840
+ utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
841
+ utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
842
+ utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
843
+ utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
844
+ utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
845
+ utils_1.assertOrUndefined(options.lineHeight, 'options.lineHeight', ['number']);
846
+ utils_1.assertOrUndefined(options.maxWidth, 'options.maxWidth', ['number']);
847
+ utils_1.assertOrUndefined(options.wordBreaks, 'options.wordBreaks', [Array]);
848
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
849
+ var _h = this.setOrEmbedFont(options.font), oldFont = _h.oldFont, newFont = _h.newFont, newFontKey = _h.newFontKey;
850
+ var fontSize = options.size || this.fontSize;
851
+ var wordBreaks = options.wordBreaks || this.doc.defaultWordBreaks;
852
+ var textWidth = function (t) { return newFont.widthOfTextAtSize(t, fontSize); };
853
+ var lines = options.maxWidth === undefined
854
+ ? utils_1.lineSplit(utils_1.cleanText(text))
855
+ : utils_1.breakTextIntoLines(text, wordBreaks, options.maxWidth, textWidth);
856
+ var encodedLines = new Array(lines.length);
857
+ for (var idx = 0, len = lines.length; idx < len; idx++) {
858
+ encodedLines[idx] = newFont.encodeText(lines[idx]);
859
+ }
860
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
861
+ opacity: options.opacity,
862
+ blendMode: options.blendMode,
863
+ });
864
+ var contentStream = this.getContentStream();
865
+ contentStream.push.apply(contentStream, operations_1.drawLinesOfText(encodedLines, {
866
+ color: (_a = options.color) !== null && _a !== void 0 ? _a : this.fontColor,
867
+ font: newFontKey,
868
+ size: fontSize,
869
+ rotate: (_b = options.rotate) !== null && _b !== void 0 ? _b : rotations_1.degrees(0),
870
+ xSkew: (_c = options.xSkew) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
871
+ ySkew: (_d = options.ySkew) !== null && _d !== void 0 ? _d : rotations_1.degrees(0),
872
+ x: (_e = options.x) !== null && _e !== void 0 ? _e : this.x,
873
+ y: (_f = options.y) !== null && _f !== void 0 ? _f : this.y,
874
+ lineHeight: (_g = options.lineHeight) !== null && _g !== void 0 ? _g : this.lineHeight,
875
+ graphicsState: graphicsStateKey,
876
+ }));
877
+ if (options.font) {
878
+ if (oldFont)
879
+ this.setFont(oldFont);
880
+ else
881
+ this.resetFont();
882
+ }
883
+ };
884
+ /**
885
+ * Draw an image on this page. For example:
886
+ * ```js
887
+ * import { degrees } from 'pdf-lib'
888
+ *
889
+ * const jpgUrl = 'https://pdf-lib.js.org/assets/cat_riding_unicorn.jpg'
890
+ * const jpgImageBytes = await fetch(jpgUrl).then((res) => res.arrayBuffer())
891
+ *
892
+ * const jpgImage = await pdfDoc.embedJpg(jpgImageBytes)
893
+ * const jpgDims = jpgImage.scale(0.5)
894
+ *
895
+ * const page = pdfDoc.addPage()
896
+ *
897
+ * page.drawImage(jpgImage, {
898
+ * x: 25,
899
+ * y: 25,
900
+ * width: jpgDims.width,
901
+ * height: jpgDims.height,
902
+ * rotate: degrees(30),
903
+ * opacity: 0.75,
904
+ * })
905
+ * ```
906
+ * @param image The image to be drawn.
907
+ * @param options The options to be used when drawing the image.
908
+ */
909
+ PDFPage.prototype.drawImage = function (image, options) {
910
+ var _a, _b, _c, _d, _e, _f, _g;
911
+ if (options === void 0) { options = {}; }
912
+ // TODO: Reuse image XObject name if we've already added this image to Resources.XObjects
913
+ utils_1.assertIs(image, 'image', [[PDFImage_1.default, 'PDFImage']]);
914
+ utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
915
+ utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
916
+ utils_1.assertOrUndefined(options.width, 'options.width', ['number']);
917
+ utils_1.assertOrUndefined(options.height, 'options.height', ['number']);
918
+ utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
919
+ utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
920
+ utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
921
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
922
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
923
+ var xObjectKey = this.node.newXObject('Image', image.ref);
924
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
925
+ opacity: options.opacity,
926
+ blendMode: options.blendMode,
927
+ });
928
+ var contentStream = this.getContentStream();
929
+ contentStream.push.apply(contentStream, operations_1.drawImage(xObjectKey, {
930
+ x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
931
+ y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
932
+ width: (_c = options.width) !== null && _c !== void 0 ? _c : image.size().width,
933
+ height: (_d = options.height) !== null && _d !== void 0 ? _d : image.size().height,
934
+ rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : rotations_1.degrees(0),
935
+ xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : rotations_1.degrees(0),
936
+ ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : rotations_1.degrees(0),
937
+ graphicsState: graphicsStateKey,
938
+ }));
939
+ };
940
+ /**
941
+ * Draw an embedded PDF page on this page. For example:
942
+ * ```js
943
+ * import { degrees } from 'pdf-lib'
944
+ *
945
+ * const pdfDoc = await PDFDocument.create()
946
+ * const page = pdfDoc.addPage()
947
+ *
948
+ * const sourcePdfUrl = 'https://pdf-lib.js.org/assets/with_large_page_count.pdf'
949
+ * const sourcePdf = await fetch(sourcePdfUrl).then((res) => res.arrayBuffer())
950
+ *
951
+ * // Embed page 74 from the PDF
952
+ * const [embeddedPage] = await pdfDoc.embedPdf(sourcePdf, 73)
953
+ *
954
+ * page.drawPage(embeddedPage, {
955
+ * x: 250,
956
+ * y: 200,
957
+ * xScale: 0.5,
958
+ * yScale: 0.5,
959
+ * rotate: degrees(30),
960
+ * opacity: 0.75,
961
+ * })
962
+ * ```
963
+ *
964
+ * The `options` argument accepts both `width`/`height` and `xScale`/`yScale`
965
+ * as options. Since each of these options defines the size of the drawn page,
966
+ * if both options are given, `width` and `height` take precedence and the
967
+ * corresponding scale variants are ignored.
968
+ *
969
+ * @param embeddedPage The embedded page to be drawn.
970
+ * @param options The options to be used when drawing the embedded page.
971
+ */
972
+ PDFPage.prototype.drawPage = function (embeddedPage, options) {
973
+ var _a, _b, _c, _d, _e;
974
+ if (options === void 0) { options = {}; }
975
+ // TODO: Reuse embeddedPage XObject name if we've already added this embeddedPage to Resources.XObjects
976
+ utils_1.assertIs(embeddedPage, 'embeddedPage', [
977
+ [PDFEmbeddedPage_1.default, 'PDFEmbeddedPage'],
978
+ ]);
979
+ utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
980
+ utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
981
+ utils_1.assertOrUndefined(options.xScale, 'options.xScale', ['number']);
982
+ utils_1.assertOrUndefined(options.yScale, 'options.yScale', ['number']);
983
+ utils_1.assertOrUndefined(options.width, 'options.width', ['number']);
984
+ utils_1.assertOrUndefined(options.height, 'options.height', ['number']);
985
+ utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
986
+ utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
987
+ utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
988
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
989
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
990
+ var xObjectKey = this.node.newXObject('EmbeddedPdfPage', embeddedPage.ref);
991
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
992
+ opacity: options.opacity,
993
+ blendMode: options.blendMode,
994
+ });
995
+ // prettier-ignore
996
+ var xScale = (options.width !== undefined ? options.width / embeddedPage.width
997
+ : options.xScale !== undefined ? options.xScale
998
+ : 1);
999
+ // prettier-ignore
1000
+ var yScale = (options.height !== undefined ? options.height / embeddedPage.height
1001
+ : options.yScale !== undefined ? options.yScale
1002
+ : 1);
1003
+ var contentStream = this.getContentStream();
1004
+ contentStream.push.apply(contentStream, operations_1.drawPage(xObjectKey, {
1005
+ x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
1006
+ y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
1007
+ xScale: xScale,
1008
+ yScale: yScale,
1009
+ rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
1010
+ xSkew: (_d = options.xSkew) !== null && _d !== void 0 ? _d : rotations_1.degrees(0),
1011
+ ySkew: (_e = options.ySkew) !== null && _e !== void 0 ? _e : rotations_1.degrees(0),
1012
+ graphicsState: graphicsStateKey,
1013
+ }));
1014
+ };
1015
+ /**
1016
+ * Draw an SVG path on this page. For example:
1017
+ * ```js
1018
+ * import { rgb } from 'pdf-lib'
1019
+ *
1020
+ * const svgPath = 'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90'
1021
+ *
1022
+ * // Draw path as black line
1023
+ * page.drawSvgPath(svgPath, { x: 25, y: 75 })
1024
+ *
1025
+ * // Change border style and opacity
1026
+ * page.drawSvgPath(svgPath, {
1027
+ * x: 25,
1028
+ * y: 275,
1029
+ * borderColor: rgb(0.5, 0.5, 0.5),
1030
+ * borderWidth: 2,
1031
+ * borderOpacity: 0.75,
1032
+ * })
1033
+ *
1034
+ * // Set fill color and opacity
1035
+ * page.drawSvgPath(svgPath, {
1036
+ * x: 25,
1037
+ * y: 475,
1038
+ * color: rgb(1.0, 0, 0),
1039
+ * opacity: 0.75,
1040
+ * })
1041
+ *
1042
+ * // Draw 50% of original size
1043
+ * page.drawSvgPath(svgPath, {
1044
+ * x: 25,
1045
+ * y: 675,
1046
+ * scale: 0.5,
1047
+ * })
1048
+ * ```
1049
+ * @param path The SVG path to be drawn.
1050
+ * @param options The options to be used when drawing the SVG path.
1051
+ */
1052
+ PDFPage.prototype.drawSvgPath = function (path, options) {
1053
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1054
+ if (options === void 0) { options = {}; }
1055
+ utils_1.assertIs(path, 'path', ['string']);
1056
+ utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
1057
+ utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
1058
+ utils_1.assertOrUndefined(options.scale, 'options.scale', ['number']);
1059
+ utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
1060
+ utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);
1061
+ utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
1062
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
1063
+ utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
1064
+ [Object, 'Color'],
1065
+ ]);
1066
+ utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
1067
+ Array,
1068
+ ]);
1069
+ utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
1070
+ 'number',
1071
+ ]);
1072
+ utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
1073
+ utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);
1074
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
1075
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
1076
+ opacity: options.opacity,
1077
+ borderOpacity: options.borderOpacity,
1078
+ blendMode: options.blendMode,
1079
+ });
1080
+ if (!('color' in options) && !('borderColor' in options)) {
1081
+ options.borderColor = colors_1.rgb(0, 0, 0);
1082
+ }
1083
+ var contentStream = this.getContentStream();
1084
+ contentStream.push.apply(contentStream, operations_1.drawSvgPath(path, {
1085
+ x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
1086
+ y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
1087
+ scale: options.scale,
1088
+ rotate: (_c = options.rotate) !== null && _c !== void 0 ? _c : rotations_1.degrees(0),
1089
+ color: (_d = options.color) !== null && _d !== void 0 ? _d : undefined,
1090
+ borderColor: (_e = options.borderColor) !== null && _e !== void 0 ? _e : undefined,
1091
+ borderWidth: (_f = options.borderWidth) !== null && _f !== void 0 ? _f : 0,
1092
+ borderDashArray: (_g = options.borderDashArray) !== null && _g !== void 0 ? _g : undefined,
1093
+ borderDashPhase: (_h = options.borderDashPhase) !== null && _h !== void 0 ? _h : undefined,
1094
+ borderLineCap: (_j = options.borderLineCap) !== null && _j !== void 0 ? _j : undefined,
1095
+ graphicsState: graphicsStateKey,
1096
+ }));
1097
+ };
1098
+ /**
1099
+ * Draw a line on this page. For example:
1100
+ * ```js
1101
+ * import { rgb } from 'pdf-lib'
1102
+ *
1103
+ * page.drawLine({
1104
+ * start: { x: 25, y: 75 },
1105
+ * end: { x: 125, y: 175 },
1106
+ * thickness: 2,
1107
+ * color: rgb(0.75, 0.2, 0.2),
1108
+ * opacity: 0.75,
1109
+ * })
1110
+ * ```
1111
+ * @param options The options to be used when drawing the line.
1112
+ */
1113
+ PDFPage.prototype.drawLine = function (options) {
1114
+ var _a, _b, _c, _d, _e;
1115
+ utils_1.assertIs(options.start, 'options.start', [
1116
+ [Object, '{ x: number, y: number }'],
1117
+ ]);
1118
+ utils_1.assertIs(options.end, 'options.end', [
1119
+ [Object, '{ x: number, y: number }'],
1120
+ ]);
1121
+ utils_1.assertIs(options.start.x, 'options.start.x', ['number']);
1122
+ utils_1.assertIs(options.start.y, 'options.start.y', ['number']);
1123
+ utils_1.assertIs(options.end.x, 'options.end.x', ['number']);
1124
+ utils_1.assertIs(options.end.y, 'options.end.y', ['number']);
1125
+ utils_1.assertOrUndefined(options.thickness, 'options.thickness', ['number']);
1126
+ utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
1127
+ utils_1.assertOrUndefined(options.dashArray, 'options.dashArray', [Array]);
1128
+ utils_1.assertOrUndefined(options.dashPhase, 'options.dashPhase', ['number']);
1129
+ utils_1.assertIsOneOfOrUndefined(options.lineCap, 'options.lineCap', operators_1.LineCapStyle);
1130
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
1131
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
1132
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
1133
+ borderOpacity: options.opacity,
1134
+ blendMode: options.blendMode,
1135
+ });
1136
+ if (!('color' in options)) {
1137
+ options.color = colors_1.rgb(0, 0, 0);
1138
+ }
1139
+ var contentStream = this.getContentStream();
1140
+ contentStream.push.apply(contentStream, operations_1.drawLine({
1141
+ start: options.start,
1142
+ end: options.end,
1143
+ thickness: (_a = options.thickness) !== null && _a !== void 0 ? _a : 1,
1144
+ color: (_b = options.color) !== null && _b !== void 0 ? _b : undefined,
1145
+ dashArray: (_c = options.dashArray) !== null && _c !== void 0 ? _c : undefined,
1146
+ dashPhase: (_d = options.dashPhase) !== null && _d !== void 0 ? _d : undefined,
1147
+ lineCap: (_e = options.lineCap) !== null && _e !== void 0 ? _e : undefined,
1148
+ graphicsState: graphicsStateKey,
1149
+ }));
1150
+ };
1151
+ /**
1152
+ * Draw a rectangle on this page. For example:
1153
+ * ```js
1154
+ * import { degrees, grayscale, rgb } from 'pdf-lib'
1155
+ *
1156
+ * page.drawRectangle({
1157
+ * x: 25,
1158
+ * y: 75,
1159
+ * width: 250,
1160
+ * height: 75,
1161
+ * rotate: degrees(-15),
1162
+ * borderWidth: 5,
1163
+ * borderColor: grayscale(0.5),
1164
+ * color: rgb(0.75, 0.2, 0.2),
1165
+ * opacity: 0.5,
1166
+ * borderOpacity: 0.75,
1167
+ * })
1168
+ * ```
1169
+ * @param options The options to be used when drawing the rectangle.
1170
+ */
1171
+ PDFPage.prototype.drawRectangle = function (options) {
1172
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1173
+ if (options === void 0) { options = {}; }
1174
+ utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
1175
+ utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
1176
+ utils_1.assertOrUndefined(options.width, 'options.width', ['number']);
1177
+ utils_1.assertOrUndefined(options.height, 'options.height', ['number']);
1178
+ utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
1179
+ utils_1.assertOrUndefined(options.xSkew, 'options.xSkew', [[Object, 'Rotation']]);
1180
+ utils_1.assertOrUndefined(options.ySkew, 'options.ySkew', [[Object, 'Rotation']]);
1181
+ utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);
1182
+ utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
1183
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
1184
+ utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
1185
+ [Object, 'Color'],
1186
+ ]);
1187
+ utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
1188
+ Array,
1189
+ ]);
1190
+ utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
1191
+ 'number',
1192
+ ]);
1193
+ utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
1194
+ utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);
1195
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
1196
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
1197
+ opacity: options.opacity,
1198
+ borderOpacity: options.borderOpacity,
1199
+ blendMode: options.blendMode,
1200
+ });
1201
+ if (!('color' in options) && !('borderColor' in options)) {
1202
+ options.color = colors_1.rgb(0, 0, 0);
1203
+ }
1204
+ var contentStream = this.getContentStream();
1205
+ contentStream.push.apply(contentStream, operations_1.drawRectangle({
1206
+ x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
1207
+ y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
1208
+ width: (_c = options.width) !== null && _c !== void 0 ? _c : 150,
1209
+ height: (_d = options.height) !== null && _d !== void 0 ? _d : 100,
1210
+ rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : rotations_1.degrees(0),
1211
+ xSkew: (_f = options.xSkew) !== null && _f !== void 0 ? _f : rotations_1.degrees(0),
1212
+ ySkew: (_g = options.ySkew) !== null && _g !== void 0 ? _g : rotations_1.degrees(0),
1213
+ borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,
1214
+ color: (_j = options.color) !== null && _j !== void 0 ? _j : undefined,
1215
+ borderColor: (_k = options.borderColor) !== null && _k !== void 0 ? _k : undefined,
1216
+ borderDashArray: (_l = options.borderDashArray) !== null && _l !== void 0 ? _l : undefined,
1217
+ borderDashPhase: (_m = options.borderDashPhase) !== null && _m !== void 0 ? _m : undefined,
1218
+ graphicsState: graphicsStateKey,
1219
+ borderLineCap: (_o = options.borderLineCap) !== null && _o !== void 0 ? _o : undefined,
1220
+ }));
1221
+ };
1222
+ /**
1223
+ * Draw a square on this page. For example:
1224
+ * ```js
1225
+ * import { degrees, grayscale, rgb } from 'pdf-lib'
1226
+ *
1227
+ * page.drawSquare({
1228
+ * x: 25,
1229
+ * y: 75,
1230
+ * size: 100,
1231
+ * rotate: degrees(-15),
1232
+ * borderWidth: 5,
1233
+ * borderColor: grayscale(0.5),
1234
+ * color: rgb(0.75, 0.2, 0.2),
1235
+ * opacity: 0.5,
1236
+ * borderOpacity: 0.75,
1237
+ * })
1238
+ * ```
1239
+ * @param options The options to be used when drawing the square.
1240
+ */
1241
+ PDFPage.prototype.drawSquare = function (options) {
1242
+ if (options === void 0) { options = {}; }
1243
+ var size = options.size;
1244
+ utils_1.assertOrUndefined(size, 'size', ['number']);
1245
+ this.drawRectangle(tslib_1.__assign(tslib_1.__assign({}, options), { width: size, height: size }));
1246
+ };
1247
+ /**
1248
+ * Draw an ellipse on this page. For example:
1249
+ * ```js
1250
+ * import { grayscale, rgb } from 'pdf-lib'
1251
+ *
1252
+ * page.drawEllipse({
1253
+ * x: 200,
1254
+ * y: 75,
1255
+ * xScale: 100,
1256
+ * yScale: 50,
1257
+ * borderWidth: 5,
1258
+ * borderColor: grayscale(0.5),
1259
+ * color: rgb(0.75, 0.2, 0.2),
1260
+ * opacity: 0.5,
1261
+ * borderOpacity: 0.75,
1262
+ * })
1263
+ * ```
1264
+ * @param options The options to be used when drawing the ellipse.
1265
+ */
1266
+ PDFPage.prototype.drawEllipse = function (options) {
1267
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1268
+ if (options === void 0) { options = {}; }
1269
+ utils_1.assertOrUndefined(options.x, 'options.x', ['number']);
1270
+ utils_1.assertOrUndefined(options.y, 'options.y', ['number']);
1271
+ utils_1.assertOrUndefined(options.xScale, 'options.xScale', ['number']);
1272
+ utils_1.assertOrUndefined(options.yScale, 'options.yScale', ['number']);
1273
+ utils_1.assertOrUndefined(options.rotate, 'options.rotate', [[Object, 'Rotation']]);
1274
+ utils_1.assertOrUndefined(options.color, 'options.color', [[Object, 'Color']]);
1275
+ utils_1.assertRangeOrUndefined(options.opacity, 'opacity.opacity', 0, 1);
1276
+ utils_1.assertOrUndefined(options.borderColor, 'options.borderColor', [
1277
+ [Object, 'Color'],
1278
+ ]);
1279
+ utils_1.assertRangeOrUndefined(options.borderOpacity, 'options.borderOpacity', 0, 1);
1280
+ utils_1.assertOrUndefined(options.borderWidth, 'options.borderWidth', ['number']);
1281
+ utils_1.assertOrUndefined(options.borderDashArray, 'options.borderDashArray', [
1282
+ Array,
1283
+ ]);
1284
+ utils_1.assertOrUndefined(options.borderDashPhase, 'options.borderDashPhase', [
1285
+ 'number',
1286
+ ]);
1287
+ utils_1.assertIsOneOfOrUndefined(options.borderLineCap, 'options.borderLineCap', operators_1.LineCapStyle);
1288
+ utils_1.assertIsOneOfOrUndefined(options.blendMode, 'options.blendMode', PDFPageOptions_1.BlendMode);
1289
+ var graphicsStateKey = this.maybeEmbedGraphicsState({
1290
+ opacity: options.opacity,
1291
+ borderOpacity: options.borderOpacity,
1292
+ blendMode: options.blendMode,
1293
+ });
1294
+ if (!('color' in options) && !('borderColor' in options)) {
1295
+ options.color = colors_1.rgb(0, 0, 0);
1296
+ }
1297
+ var contentStream = this.getContentStream();
1298
+ contentStream.push.apply(contentStream, operations_1.drawEllipse({
1299
+ x: (_a = options.x) !== null && _a !== void 0 ? _a : this.x,
1300
+ y: (_b = options.y) !== null && _b !== void 0 ? _b : this.y,
1301
+ xScale: (_c = options.xScale) !== null && _c !== void 0 ? _c : 100,
1302
+ yScale: (_d = options.yScale) !== null && _d !== void 0 ? _d : 100,
1303
+ rotate: (_e = options.rotate) !== null && _e !== void 0 ? _e : undefined,
1304
+ color: (_f = options.color) !== null && _f !== void 0 ? _f : undefined,
1305
+ borderColor: (_g = options.borderColor) !== null && _g !== void 0 ? _g : undefined,
1306
+ borderWidth: (_h = options.borderWidth) !== null && _h !== void 0 ? _h : 0,
1307
+ borderDashArray: (_j = options.borderDashArray) !== null && _j !== void 0 ? _j : undefined,
1308
+ borderDashPhase: (_k = options.borderDashPhase) !== null && _k !== void 0 ? _k : undefined,
1309
+ borderLineCap: (_l = options.borderLineCap) !== null && _l !== void 0 ? _l : undefined,
1310
+ graphicsState: graphicsStateKey,
1311
+ }));
1312
+ };
1313
+ /**
1314
+ * Draw a circle on this page. For example:
1315
+ * ```js
1316
+ * import { grayscale, rgb } from 'pdf-lib'
1317
+ *
1318
+ * page.drawCircle({
1319
+ * x: 200,
1320
+ * y: 150,
1321
+ * size: 100,
1322
+ * borderWidth: 5,
1323
+ * borderColor: grayscale(0.5),
1324
+ * color: rgb(0.75, 0.2, 0.2),
1325
+ * opacity: 0.5,
1326
+ * borderOpacity: 0.75,
1327
+ * })
1328
+ * ```
1329
+ * @param options The options to be used when drawing the ellipse.
1330
+ */
1331
+ PDFPage.prototype.drawCircle = function (options) {
1332
+ if (options === void 0) { options = {}; }
1333
+ var _a = options.size, size = _a === void 0 ? 100 : _a;
1334
+ utils_1.assertOrUndefined(size, 'size', ['number']);
1335
+ this.drawEllipse(tslib_1.__assign(tslib_1.__assign({}, options), { xScale: size, yScale: size }));
1336
+ };
1337
+ PDFPage.prototype.setOrEmbedFont = function (font) {
1338
+ var oldFont = this.font;
1339
+ var oldFontKey = this.fontKey;
1340
+ if (font)
1341
+ this.setFont(font);
1342
+ else
1343
+ this.getFont();
1344
+ var newFont = this.font;
1345
+ var newFontKey = this.fontKey;
1346
+ return { oldFont: oldFont, oldFontKey: oldFontKey, newFont: newFont, newFontKey: newFontKey };
1347
+ };
1348
+ PDFPage.prototype.getFont = function () {
1349
+ if (!this.font || !this.fontKey) {
1350
+ var font = this.doc.embedStandardFont(StandardFonts_1.StandardFonts.Helvetica);
1351
+ this.setFont(font);
1352
+ }
1353
+ return [this.font, this.fontKey];
1354
+ };
1355
+ PDFPage.prototype.resetFont = function () {
1356
+ this.font = undefined;
1357
+ this.fontKey = undefined;
1358
+ };
1359
+ PDFPage.prototype.getContentStream = function (useExisting) {
1360
+ if (useExisting === void 0) { useExisting = true; }
1361
+ if (useExisting && this.contentStream)
1362
+ return this.contentStream;
1363
+ this.contentStream = this.createContentStream();
1364
+ this.contentStreamRef = this.doc.context.register(this.contentStream);
1365
+ this.node.addContentStream(this.contentStreamRef);
1366
+ return this.contentStream;
1367
+ };
1368
+ PDFPage.prototype.createContentStream = function () {
1369
+ var operators = [];
1370
+ for (var _i = 0; _i < arguments.length; _i++) {
1371
+ operators[_i] = arguments[_i];
1372
+ }
1373
+ var dict = this.doc.context.obj({});
1374
+ var contentStream = core_1.PDFContentStream.of(dict, operators);
1375
+ return contentStream;
1376
+ };
1377
+ PDFPage.prototype.maybeEmbedGraphicsState = function (options) {
1378
+ var opacity = options.opacity, borderOpacity = options.borderOpacity, blendMode = options.blendMode;
1379
+ if (opacity === undefined &&
1380
+ borderOpacity === undefined &&
1381
+ blendMode === undefined) {
1382
+ return undefined;
1383
+ }
1384
+ var graphicsState = this.doc.context.obj({
1385
+ Type: 'ExtGState',
1386
+ ca: opacity,
1387
+ CA: borderOpacity,
1388
+ BM: blendMode,
1389
+ });
1390
+ var key = this.node.newExtGState('GS', graphicsState);
1391
+ return key;
1392
+ };
1393
+ PDFPage.prototype.scaleAnnot = function (annot, x, y) {
1394
+ var selectors = ['RD', 'CL', 'Vertices', 'QuadPoints', 'L', 'Rect'];
1395
+ for (var idx = 0, len = selectors.length; idx < len; idx++) {
1396
+ var list = annot.lookup(core_1.PDFName.of(selectors[idx]));
1397
+ if (list instanceof core_1.PDFArray)
1398
+ list.scalePDFNumbers(x, y);
1399
+ }
1400
+ var inkLists = annot.lookup(core_1.PDFName.of('InkList'));
1401
+ if (inkLists instanceof core_1.PDFArray) {
1402
+ for (var idx = 0, len = inkLists.size(); idx < len; idx++) {
1403
+ var arr = inkLists.lookup(idx);
1404
+ if (arr instanceof core_1.PDFArray)
1405
+ arr.scalePDFNumbers(x, y);
1406
+ }
1407
+ }
1408
+ };
1409
+ /**
1410
+ * > **NOTE:** You probably don't want to call this method directly. Instead,
1411
+ * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]
1412
+ * > methods, which can create instances of [[PDFPage]] for you.
1413
+ *
1414
+ * Create an instance of [[PDFPage]] from an existing leaf node.
1415
+ *
1416
+ * @param leafNode The leaf node to be wrapped.
1417
+ * @param ref The unique reference for the page.
1418
+ * @param doc The document to which the page will belong.
1419
+ */
1420
+ PDFPage.of = function (leafNode, ref, doc) {
1421
+ return new PDFPage(leafNode, ref, doc);
1422
+ };
1423
+ /**
1424
+ * > **NOTE:** You probably don't want to call this method directly. Instead,
1425
+ * > consider using the [[PDFDocument.addPage]] and [[PDFDocument.insertPage]]
1426
+ * > methods, which can create instances of [[PDFPage]] for you.
1427
+ *
1428
+ * Create an instance of [[PDFPage]].
1429
+ *
1430
+ * @param doc The document to which the page will belong.
1431
+ */
1432
+ PDFPage.create = function (doc) {
1433
+ utils_1.assertIs(doc, 'doc', [[PDFDocument_1.default, 'PDFDocument']]);
1434
+ var dummyRef = core_1.PDFRef.of(-1);
1435
+ var pageLeaf = core_1.PDFPageLeaf.withContextAndParent(doc.context, dummyRef);
1436
+ var pageRef = doc.context.register(pageLeaf);
1437
+ return new PDFPage(pageLeaf, pageRef, doc);
1438
+ };
1439
+ return PDFPage;
1440
+ }());
1441
+ exports.default = PDFPage;
1442
+ //# sourceMappingURL=PDFPage.js.map