@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
package/README.md ADDED
@@ -0,0 +1,1513 @@
1
+ @pdfme/pdf-lib
2
+ this version is forked from [Hopding/pdf-lib](https://github.com/Hopding/pdf-lib).
3
+ @pdfme/pdf-lib compatible with [foliojs/fontkit](https://github.com/foliojs/fontkit) v2
4
+
5
+ To fix this issue -> [Character corruption occurs when enabling subsets for some Japanese and Chinese fonts #162](https://github.com/pdfme/pdfme/issues/162)
6
+
7
+
8
+ ---
9
+
10
+ <a href="https://pdf-lib.js.org">
11
+ <h1 align="center">
12
+ <img alt="pdf-lib" height="300" src="https://raw.githubusercontent.com/Hopding/pdf-lib-docs/master/assets/logo-full.svg?sanitize=true">
13
+ </h1>
14
+ </a>
15
+
16
+ <div align="center">
17
+ <strong>Create and modify PDF documents in any JavaScript environment.</strong>
18
+ </div>
19
+ <div align="center">
20
+ Designed to work in any modern JavaScript runtime. Tested in Node, Browser, Deno, and React Native environments.
21
+ </div>
22
+
23
+ <br />
24
+
25
+ <div align="center">
26
+ <!-- NPM Version -->
27
+ <a href="https://www.npmjs.com/package/pdf-lib">
28
+ <img
29
+ src="https://img.shields.io/npm/v/pdf-lib.svg?style=flat-square"
30
+ alt="NPM Version"
31
+ />
32
+ </a>
33
+ <!-- Build Status -->
34
+ <a href="https://circleci.com/gh/Hopding/pdf-lib">
35
+ <img
36
+ src="https://img.shields.io/circleci/project/github/Hopding/pdf-lib/master.svg?style=flat-square&label=CircleCI"
37
+ alt="CircleCI Build Status"
38
+ />
39
+ </a>
40
+ <!-- Prettier Badge -->
41
+ <a href="https://prettier.io/">
42
+ <img
43
+ src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"
44
+ alt="Prettier Badge"
45
+ />
46
+ </a>
47
+ <!-- Discord Badge -->
48
+ <a href="https://discord.gg/Y7uuVMc">
49
+ <img
50
+ src="https://img.shields.io/static/v1?label=discord&message=pdf-lib&color=566fbb&style=flat-square"
51
+ alt="Discord Badge"
52
+ />
53
+ </a>
54
+ </div>
55
+
56
+ <br />
57
+
58
+ > **Learn more at [pdf-lib.js.org](https://pdf-lib.js.org)**
59
+
60
+ ## Table of Contents
61
+
62
+ - [Features](#features)
63
+ - [Motivation](#motivation)
64
+ - [Usage Examples](#usage-examples)
65
+ - [Create Document](#create-document)
66
+ - [Modify Document](#modify-document)
67
+ - [Create Form](#create-form)
68
+ - [Fill Form](#fill-form)
69
+ - [Flatten Form](#flatten-form)
70
+ - [Copy Pages](#copy-pages)
71
+ - [Embed PNG and JPEG Images](#embed-png-and-jpeg-images)
72
+ - [Embed PDF Pages](#embed-pdf-pages)
73
+ - [Embed Font and Measure Text](#embed-font-and-measure-text)
74
+ - [Add Attachments](#add-attachments)
75
+ - [Set Document Metadata](#set-document-metadata)
76
+ - [Read Document Metadata](#read-document-metadata)
77
+ - [Set Viewer Preferences](#set-viewer-preferences)
78
+ - [Read Viewer Preferences](#read-viewer-preferences)
79
+ - [Draw SVG Paths](#draw-svg-paths)
80
+ - [Deno Usage](#deno-usage)
81
+ - [Complete Examples](#complete-examples)
82
+ - [Installation](#installation)
83
+ - [Documentation](#documentation)
84
+ - [Fonts and Unicode](#fonts-and-unicode)
85
+ - [Creating and Filling Forms](#creating-and-filling-forms)
86
+ - [Limitations](#limitations)
87
+ - [Help and Discussion](#help-and-discussion)
88
+ - [Encryption Handling](#encryption-handling)
89
+ - [Migrating to v1.0.0](docs/MIGRATION.md)
90
+ - [Contributing](#contributing)
91
+ - [Maintainership](#maintainership)
92
+ - [Tutorials and Cool Stuff](#tutorials-and-cool-stuff)
93
+ - [Prior Art](#prior-art)
94
+ - [Git History Rewrite](#git-history-rewrite)
95
+ - [License](#license)
96
+
97
+ ## Features
98
+
99
+ - Create new PDFs
100
+ - Modify existing PDFs
101
+ - Create forms
102
+ - Fill forms
103
+ - Flatten forms
104
+ - Add Pages
105
+ - Insert Pages
106
+ - Remove Pages
107
+ - Copy pages between PDFs
108
+ - Draw Text
109
+ - Draw Images
110
+ - Draw PDF Pages
111
+ - Draw Vector Graphics
112
+ - Draw SVG Paths
113
+ - Measure width and height of text
114
+ - Embed Fonts (supports UTF-8 and UTF-16 character sets)
115
+ - Set document metadata
116
+ - Read document metadata
117
+ - Set viewer preferences
118
+ - Read viewer preferences
119
+ - Add attachments
120
+
121
+ ## Motivation
122
+
123
+ `pdf-lib` was created to address the JavaScript ecosystem's lack of robust support for PDF manipulation (especially for PDF _modification_).
124
+
125
+ Two of `pdf-lib`'s distinguishing features are:
126
+
127
+ 1. Supporting modification (editing) of existing documents.
128
+ 2. Working in all JavaScript environments - not just in Node or the Browser.
129
+
130
+ There are [other](#prior-art) good open source JavaScript PDF libraries available. However, most of them can only _create_ documents, they cannot _modify_ existing ones. And many of them only work in particular environments.
131
+
132
+ ## Usage Examples
133
+
134
+ ### Create Document
135
+
136
+ _This example produces [this PDF](assets/pdfs/examples/create_document.pdf)._
137
+
138
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/rxwsc8f5/13/)
139
+
140
+ <!-- prettier-ignore -->
141
+ ```js
142
+ import { PDFDocument, StandardFonts, rgb } from 'pdf-lib'
143
+
144
+ // Create a new PDFDocument
145
+ const pdfDoc = await PDFDocument.create()
146
+
147
+ // Embed the Times Roman font
148
+ const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
149
+
150
+ // Add a blank page to the document
151
+ const page = pdfDoc.addPage()
152
+
153
+ // Get the width and height of the page
154
+ const { width, height } = page.getSize()
155
+
156
+ // Draw a string of text toward the top of the page
157
+ const fontSize = 30
158
+ page.drawText('Creating PDFs in JavaScript is awesome!', {
159
+ x: 50,
160
+ y: height - 4 * fontSize,
161
+ size: fontSize,
162
+ font: timesRomanFont,
163
+ color: rgb(0, 0.53, 0.71),
164
+ })
165
+
166
+ // Serialize the PDFDocument to bytes (a Uint8Array)
167
+ const pdfBytes = await pdfDoc.save()
168
+
169
+ // For example, `pdfBytes` can be:
170
+ // • Written to a file in Node
171
+ // • Downloaded from the browser
172
+ // • Rendered in an <iframe>
173
+ ```
174
+
175
+ ### Modify Document
176
+
177
+ _This example produces [this PDF](assets/pdfs/examples/modify_document.pdf)_ (when [this PDF](assets/pdfs/with_update_sections.pdf) is used for the `existingPdfBytes` variable).
178
+
179
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/64zajhge/1/)
180
+
181
+ <!-- prettier-ignore -->
182
+ ```js
183
+ import { degrees, PDFDocument, rgb, StandardFonts } from 'pdf-lib';
184
+
185
+ // This should be a Uint8Array or ArrayBuffer
186
+ // This data can be obtained in a number of different ways
187
+ // If your running in a Node environment, you could use fs.readFile()
188
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
189
+ const existingPdfBytes = ...
190
+
191
+ // Load a PDFDocument from the existing PDF bytes
192
+ const pdfDoc = await PDFDocument.load(existingPdfBytes)
193
+
194
+ // Embed the Helvetica font
195
+ const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)
196
+
197
+ // Get the first page of the document
198
+ const pages = pdfDoc.getPages()
199
+ const firstPage = pages[0]
200
+
201
+ // Get the width and height of the first page
202
+ const { width, height } = firstPage.getSize()
203
+
204
+ // Draw a string of text diagonally across the first page
205
+ firstPage.drawText('This text was added with JavaScript!', {
206
+ x: 5,
207
+ y: height / 2 + 300,
208
+ size: 50,
209
+ font: helveticaFont,
210
+ color: rgb(0.95, 0.1, 0.1),
211
+ rotate: degrees(-45),
212
+ })
213
+
214
+
215
+ // Serialize the PDFDocument to bytes (a Uint8Array)
216
+ const pdfBytes = await pdfDoc.save()
217
+
218
+ // For example, `pdfBytes` can be:
219
+ // • Written to a file in Node
220
+ // • Downloaded from the browser
221
+ // • Rendered in an <iframe>
222
+ ```
223
+
224
+ ### Create Form
225
+
226
+ _This example produces [this PDF](assets/pdfs/examples/create_form.pdf)._
227
+
228
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/bct7vngL/4/)
229
+
230
+ > See also [Creating and Filling Forms](#creating-and-filling-forms)
231
+
232
+ <!-- prettier-ignore -->
233
+ ```js
234
+ import { PDFDocument } from 'pdf-lib'
235
+
236
+ // Create a new PDFDocument
237
+ const pdfDoc = await PDFDocument.create()
238
+
239
+ // Add a blank page to the document
240
+ const page = pdfDoc.addPage([550, 750])
241
+
242
+ // Get the form so we can add fields to it
243
+ const form = pdfDoc.getForm()
244
+
245
+ // Add the superhero text field and description
246
+ page.drawText('Enter your favorite superhero:', { x: 50, y: 700, size: 20 })
247
+
248
+ const superheroField = form.createTextField('favorite.superhero')
249
+ superheroField.setText('One Punch Man')
250
+ superheroField.addToPage(page, { x: 55, y: 640 })
251
+
252
+ // Add the rocket radio group, labels, and description
253
+ page.drawText('Select your favorite rocket:', { x: 50, y: 600, size: 20 })
254
+
255
+ page.drawText('Falcon Heavy', { x: 120, y: 560, size: 18 })
256
+ page.drawText('Saturn IV', { x: 120, y: 500, size: 18 })
257
+ page.drawText('Delta IV Heavy', { x: 340, y: 560, size: 18 })
258
+ page.drawText('Space Launch System', { x: 340, y: 500, size: 18 })
259
+
260
+ const rocketField = form.createRadioGroup('favorite.rocket')
261
+ rocketField.addOptionToPage('Falcon Heavy', page, { x: 55, y: 540 })
262
+ rocketField.addOptionToPage('Saturn IV', page, { x: 55, y: 480 })
263
+ rocketField.addOptionToPage('Delta IV Heavy', page, { x: 275, y: 540 })
264
+ rocketField.addOptionToPage('Space Launch System', page, { x: 275, y: 480 })
265
+ rocketField.select('Saturn IV')
266
+
267
+ // Add the gundam check boxes, labels, and description
268
+ page.drawText('Select your favorite gundams:', { x: 50, y: 440, size: 20 })
269
+
270
+ page.drawText('Exia', { x: 120, y: 400, size: 18 })
271
+ page.drawText('Kyrios', { x: 120, y: 340, size: 18 })
272
+ page.drawText('Virtue', { x: 340, y: 400, size: 18 })
273
+ page.drawText('Dynames', { x: 340, y: 340, size: 18 })
274
+
275
+ const exiaField = form.createCheckBox('gundam.exia')
276
+ const kyriosField = form.createCheckBox('gundam.kyrios')
277
+ const virtueField = form.createCheckBox('gundam.virtue')
278
+ const dynamesField = form.createCheckBox('gundam.dynames')
279
+
280
+ exiaField.addToPage(page, { x: 55, y: 380 })
281
+ kyriosField.addToPage(page, { x: 55, y: 320 })
282
+ virtueField.addToPage(page, { x: 275, y: 380 })
283
+ dynamesField.addToPage(page, { x: 275, y: 320 })
284
+
285
+ exiaField.check()
286
+ dynamesField.check()
287
+
288
+ // Add the planet dropdown and description
289
+ page.drawText('Select your favorite planet*:', { x: 50, y: 280, size: 20 })
290
+
291
+ const planetsField = form.createDropdown('favorite.planet')
292
+ planetsField.addOptions(['Venus', 'Earth', 'Mars', 'Pluto'])
293
+ planetsField.select('Pluto')
294
+ planetsField.addToPage(page, { x: 55, y: 220 })
295
+
296
+ // Add the person option list and description
297
+ page.drawText('Select your favorite person:', { x: 50, y: 180, size: 18 })
298
+
299
+ const personField = form.createOptionList('favorite.person')
300
+ personField.addOptions([
301
+ 'Julius Caesar',
302
+ 'Ada Lovelace',
303
+ 'Cleopatra',
304
+ 'Aaron Burr',
305
+ 'Mark Antony',
306
+ ])
307
+ personField.select('Ada Lovelace')
308
+ personField.addToPage(page, { x: 55, y: 70 })
309
+
310
+ // Just saying...
311
+ page.drawText(`* Pluto should be a planet too!`, { x: 15, y: 15, size: 15 })
312
+
313
+ // Serialize the PDFDocument to bytes (a Uint8Array)
314
+ const pdfBytes = await pdfDoc.save()
315
+
316
+ // For example, `pdfBytes` can be:
317
+ // • Written to a file in Node
318
+ // • Downloaded from the browser
319
+ // • Rendered in an <iframe>
320
+ ```
321
+
322
+ ### Fill Form
323
+
324
+ _This example produces [this PDF](assets/pdfs/examples/fill_form.pdf)_ (when [this PDF](assets/pdfs/dod_character.pdf) is used for the `formPdfBytes` variable, [this image](assets/images/small_mario.png) is used for the `marioImageBytes` variable, and [this image](assets/images/mario_emblem.png) is used for the `emblemImageBytes` variable).
325
+
326
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/0mwfqkv6/3/)
327
+
328
+ > See also [Creating and Filling Forms](#creating-and-filling-forms)
329
+
330
+ <!-- prettier-ignore -->
331
+ ```js
332
+ import { PDFDocument } from 'pdf-lib'
333
+
334
+ // These should be Uint8Arrays or ArrayBuffers
335
+ // This data can be obtained in a number of different ways
336
+ // If your running in a Node environment, you could use fs.readFile()
337
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
338
+ const formPdfBytes = ...
339
+ const marioImageBytes = ...
340
+ const emblemImageBytes = ...
341
+
342
+ // Load a PDF with form fields
343
+ const pdfDoc = await PDFDocument.load(formPdfBytes)
344
+
345
+ // Embed the Mario and emblem images
346
+ const marioImage = await pdfDoc.embedPng(marioImageBytes)
347
+ const emblemImage = await pdfDoc.embedPng(emblemImageBytes)
348
+
349
+ // Get the form containing all the fields
350
+ const form = pdfDoc.getForm()
351
+
352
+ // Get all fields in the PDF by their names
353
+ const nameField = form.getTextField('CharacterName 2')
354
+ const ageField = form.getTextField('Age')
355
+ const heightField = form.getTextField('Height')
356
+ const weightField = form.getTextField('Weight')
357
+ const eyesField = form.getTextField('Eyes')
358
+ const skinField = form.getTextField('Skin')
359
+ const hairField = form.getTextField('Hair')
360
+
361
+ const alliesField = form.getTextField('Allies')
362
+ const factionField = form.getTextField('FactionName')
363
+ const backstoryField = form.getTextField('Backstory')
364
+ const traitsField = form.getTextField('Feat+Traits')
365
+ const treasureField = form.getTextField('Treasure')
366
+
367
+ const characterImageField = form.getButton('CHARACTER IMAGE')
368
+ const factionImageField = form.getTextField('Faction Symbol Image')
369
+
370
+ // Fill in the basic info fields
371
+ nameField.setText('Mario')
372
+ ageField.setText('24 years')
373
+ heightField.setText(`5' 1"`)
374
+ weightField.setText('196 lbs')
375
+ eyesField.setText('blue')
376
+ skinField.setText('white')
377
+ hairField.setText('brown')
378
+
379
+ // Fill the character image field with our Mario image
380
+ characterImageField.setImage(marioImage)
381
+
382
+ // Fill in the allies field
383
+ alliesField.setText(
384
+ [
385
+ `Allies:`,
386
+ ` • Princess Daisy`,
387
+ ` • Princess Peach`,
388
+ ` • Rosalina`,
389
+ ` • Geno`,
390
+ ` • Luigi`,
391
+ ` • Donkey Kong`,
392
+ ` • Yoshi`,
393
+ ` • Diddy Kong`,
394
+ ``,
395
+ `Organizations:`,
396
+ ` • Italian Plumbers Association`,
397
+ ].join('\n'),
398
+ )
399
+
400
+ // Fill in the faction name field
401
+ factionField.setText(`Mario's Emblem`)
402
+
403
+ // Fill the faction image field with our emblem image
404
+ factionImageField.setImage(emblemImage)
405
+
406
+ // Fill in the backstory field
407
+ backstoryField.setText(
408
+ `Mario is a fictional character in the Mario video game franchise, owned by Nintendo and created by Japanese video game designer Shigeru Miyamoto. Serving as the company's mascot and the eponymous protagonist of the series, Mario has appeared in over 200 video games since his creation. Depicted as a short, pudgy, Italian plumber who resides in the Mushroom Kingdom, his adventures generally center upon rescuing Princess Peach from the Koopa villain Bowser. His younger brother and sidekick is Luigi.`,
409
+ )
410
+
411
+ // Fill in the traits field
412
+ traitsField.setText(
413
+ [
414
+ `Mario can use three basic three power-ups:`,
415
+ ` • the Super Mushroom, which causes Mario to grow larger`,
416
+ ` • the Fire Flower, which allows Mario to throw fireballs`,
417
+ ` • the Starman, which gives Mario temporary invincibility`,
418
+ ].join('\n'),
419
+ )
420
+
421
+ // Fill in the treasure field
422
+ treasureField.setText(['• Gold coins', '• Treasure chests'].join('\n'))
423
+
424
+ // Serialize the PDFDocument to bytes (a Uint8Array)
425
+ const pdfBytes = await pdfDoc.save()
426
+
427
+ // For example, `pdfBytes` can be:
428
+ // • Written to a file in Node
429
+ // • Downloaded from the browser
430
+ // • Rendered in an <iframe>
431
+ ```
432
+
433
+ ### Flatten Form
434
+
435
+ _This example produces [this PDF](assets/pdfs/examples/flatten_form.pdf)_ (when [this PDF](assets/pdfs/form_to_flatten.pdf) is used for the `formPdfBytes` variable).
436
+
437
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/skevywdz/2/)
438
+
439
+ <!-- prettier-ignore -->
440
+ ```js
441
+ import { PDFDocument } from 'pdf-lib'
442
+
443
+ // This should be a Uint8Array or ArrayBuffer
444
+ // This data can be obtained in a number of different ways
445
+ // If your running in a Node environment, you could use fs.readFile()
446
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
447
+ const formPdfBytes = ...
448
+
449
+ // Load a PDF with form fields
450
+ const pdfDoc = await PDFDocument.load(formPdfBytes)
451
+
452
+ // Get the form containing all the fields
453
+ const form = pdfDoc.getForm()
454
+
455
+ // Fill the form's fields
456
+ form.getTextField('Text1').setText('Some Text');
457
+
458
+ form.getRadioGroup('Group2').select('Choice1');
459
+ form.getRadioGroup('Group3').select('Choice3');
460
+ form.getRadioGroup('Group4').select('Choice1');
461
+
462
+ form.getCheckBox('Check Box3').check();
463
+ form.getCheckBox('Check Box4').uncheck();
464
+
465
+ form.getDropdown('Dropdown7').select('Infinity');
466
+
467
+ form.getOptionList('List Box6').select('Honda');
468
+
469
+ // Flatten the form's fields
470
+ form.flatten();
471
+
472
+ // Serialize the PDFDocument to bytes (a Uint8Array)
473
+ const pdfBytes = await pdfDoc.save()
474
+
475
+ // For example, `pdfBytes` can be:
476
+ // • Written to a file in Node
477
+ // • Downloaded from the browser
478
+ // • Rendered in an <iframe>
479
+ ```
480
+
481
+ ### Copy Pages
482
+
483
+ _This example produces [this PDF](assets/pdfs/examples/copy_pages.pdf)_ (when [this PDF](assets/pdfs/with_update_sections.pdf) is used for the `firstDonorPdfBytes` variable and [this PDF](assets/pdfs/with_large_page_count.pdf) is used for the `secondDonorPdfBytes` variable).
484
+
485
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/ybank8s9/2/)
486
+
487
+ <!-- prettier-ignore -->
488
+ ```js
489
+ import { PDFDocument } from 'pdf-lib'
490
+
491
+ // Create a new PDFDocument
492
+ const pdfDoc = await PDFDocument.create()
493
+
494
+ // These should be Uint8Arrays or ArrayBuffers
495
+ // This data can be obtained in a number of different ways
496
+ // If your running in a Node environment, you could use fs.readFile()
497
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
498
+ const firstDonorPdfBytes = ...
499
+ const secondDonorPdfBytes = ...
500
+
501
+ // Load a PDFDocument from each of the existing PDFs
502
+ const firstDonorPdfDoc = await PDFDocument.load(firstDonorPdfBytes)
503
+ const secondDonorPdfDoc = await PDFDocument.load(secondDonorPdfBytes)
504
+
505
+ // Copy the 1st page from the first donor document, and
506
+ // the 743rd page from the second donor document
507
+ const [firstDonorPage] = await pdfDoc.copyPages(firstDonorPdfDoc, [0])
508
+ const [secondDonorPage] = await pdfDoc.copyPages(secondDonorPdfDoc, [742])
509
+
510
+ // Add the first copied page
511
+ pdfDoc.addPage(firstDonorPage)
512
+
513
+ // Insert the second copied page to index 0, so it will be the
514
+ // first page in `pdfDoc`
515
+ pdfDoc.insertPage(0, secondDonorPage)
516
+
517
+ // Serialize the PDFDocument to bytes (a Uint8Array)
518
+ const pdfBytes = await pdfDoc.save()
519
+
520
+ // For example, `pdfBytes` can be:
521
+ // • Written to a file in Node
522
+ // • Downloaded from the browser
523
+ // • Rendered in an <iframe>
524
+ ```
525
+
526
+ ### Embed PNG and JPEG Images
527
+
528
+ _This example produces [this PDF](assets/pdfs/examples/embed_png_and_jpeg_images.pdf)_ (when [this image](assets/images/cat_riding_unicorn.jpg) is used for the `jpgImageBytes` variable and [this image](assets/images/minions_banana_alpha.png) is used for the `pngImageBytes` variable).
529
+
530
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/bcya43ju/5/)
531
+
532
+ <!-- prettier-ignore -->
533
+ ```js
534
+ import { PDFDocument } from 'pdf-lib'
535
+
536
+ // These should be Uint8Arrays or ArrayBuffers
537
+ // This data can be obtained in a number of different ways
538
+ // If your running in a Node environment, you could use fs.readFile()
539
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
540
+ const jpgImageBytes = ...
541
+ const pngImageBytes = ...
542
+
543
+ // Create a new PDFDocument
544
+ const pdfDoc = await PDFDocument.create()
545
+
546
+ // Embed the JPG image bytes and PNG image bytes
547
+ const jpgImage = await pdfDoc.embedJpg(jpgImageBytes)
548
+ const pngImage = await pdfDoc.embedPng(pngImageBytes)
549
+
550
+ // Get the width/height of the JPG image scaled down to 25% of its original size
551
+ const jpgDims = jpgImage.scale(0.25)
552
+
553
+ // Get the width/height of the PNG image scaled down to 50% of its original size
554
+ const pngDims = pngImage.scale(0.5)
555
+
556
+ // Add a blank page to the document
557
+ const page = pdfDoc.addPage()
558
+
559
+ // Draw the JPG image in the center of the page
560
+ page.drawImage(jpgImage, {
561
+ x: page.getWidth() / 2 - jpgDims.width / 2,
562
+ y: page.getHeight() / 2 - jpgDims.height / 2,
563
+ width: jpgDims.width,
564
+ height: jpgDims.height,
565
+ })
566
+
567
+ // Draw the PNG image near the lower right corner of the JPG image
568
+ page.drawImage(pngImage, {
569
+ x: page.getWidth() / 2 - pngDims.width / 2 + 75,
570
+ y: page.getHeight() / 2 - pngDims.height,
571
+ width: pngDims.width,
572
+ height: pngDims.height,
573
+ })
574
+
575
+ // Serialize the PDFDocument to bytes (a Uint8Array)
576
+ const pdfBytes = await pdfDoc.save()
577
+
578
+ // For example, `pdfBytes` can be:
579
+ // • Written to a file in Node
580
+ // • Downloaded from the browser
581
+ // • Rendered in an <iframe>
582
+ ```
583
+
584
+ ### Embed PDF Pages
585
+
586
+ _This example produces [this PDF](assets/pdfs/examples/embed_pdf_pages.pdf)_ (when [this PDF](assets/pdfs/american_flag.pdf) is used for the `americanFlagPdfBytes` variable and [this PDF](assets/pdfs/us_constitution.pdf) is used for the `usConstitutionPdfBytes` variable).
587
+
588
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/Lyb16ocj/13/)
589
+
590
+ <!-- prettier-ignore -->
591
+ ```js
592
+ import { PDFDocument } from 'pdf-lib'
593
+
594
+ // These should be Uint8Arrays or ArrayBuffers
595
+ // This data can be obtained in a number of different ways
596
+ // If your running in a Node environment, you could use fs.readFile()
597
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
598
+ const americanFlagPdfBytes = ...
599
+ const usConstitutionPdfBytes = ...
600
+
601
+ // Create a new PDFDocument
602
+ const pdfDoc = await PDFDocument.create()
603
+
604
+ // Embed the American flag PDF bytes
605
+ const [americanFlag] = await pdfDoc.embedPdf(americanFlagPdfBytes)
606
+
607
+ // Load the U.S. constitution PDF bytes
608
+ const usConstitutionPdf = await PDFDocument.load(usConstitutionPdfBytes)
609
+
610
+ // Embed the second page of the constitution and clip the preamble
611
+ const preamble = await pdfDoc.embedPage(usConstitutionPdf.getPages()[1], {
612
+ left: 55,
613
+ bottom: 485,
614
+ right: 300,
615
+ top: 575,
616
+ })
617
+
618
+ // Get the width/height of the American flag PDF scaled down to 30% of
619
+ // its original size
620
+ const americanFlagDims = americanFlag.scale(0.3)
621
+
622
+ // Get the width/height of the preamble clipping scaled up to 225% of
623
+ // its original size
624
+ const preambleDims = preamble.scale(2.25)
625
+
626
+ // Add a blank page to the document
627
+ const page = pdfDoc.addPage()
628
+
629
+ // Draw the American flag image in the center top of the page
630
+ page.drawPage(americanFlag, {
631
+ ...americanFlagDims,
632
+ x: page.getWidth() / 2 - americanFlagDims.width / 2,
633
+ y: page.getHeight() - americanFlagDims.height - 150,
634
+ })
635
+
636
+ // Draw the preamble clipping in the center bottom of the page
637
+ page.drawPage(preamble, {
638
+ ...preambleDims,
639
+ x: page.getWidth() / 2 - preambleDims.width / 2,
640
+ y: page.getHeight() / 2 - preambleDims.height / 2 - 50,
641
+ })
642
+
643
+ // Serialize the PDFDocument to bytes (a Uint8Array)
644
+ const pdfBytes = await pdfDoc.save()
645
+
646
+ // For example, `pdfBytes` can be:
647
+ // • Written to a file in Node
648
+ // • Downloaded from the browser
649
+ // • Rendered in an <iframe>
650
+ ```
651
+
652
+ ### Embed Font and Measure Text
653
+
654
+ `pdf-lib` relies on a sister module to support embedding custom fonts: [`@pdf-lib/fontkit`](https://www.npmjs.com/package/@pdf-lib/fontkit). You must add the `@pdf-lib/fontkit` module to your project and register it using `pdfDoc.registerFontkit(...)` before embedding custom fonts.
655
+
656
+ > **[See below for detailed installation instructions on installing `@pdf-lib/fontkit` as a UMD or NPM module.](#fontkit-installation)**
657
+
658
+ _This example produces [this PDF](assets/pdfs/examples/embed_font_and_measure_text.pdf)_ (when [this font](assets/fonts/ubuntu/Ubuntu-R.ttf) is used for the `fontBytes` variable).
659
+
660
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/rgu6ca59/2/)
661
+
662
+ <!-- prettier-ignore -->
663
+ ```js
664
+ import { PDFDocument, rgb } from 'pdf-lib'
665
+ import fontkit from '@pdf-lib/fontkit'
666
+
667
+ // This should be a Uint8Array or ArrayBuffer
668
+ // This data can be obtained in a number of different ways
669
+ // If you're running in a Node environment, you could use fs.readFile()
670
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
671
+ const fontBytes = ...
672
+
673
+ // Create a new PDFDocument
674
+ const pdfDoc = await PDFDocument.create()
675
+
676
+ // Register the `fontkit` instance
677
+ pdfDoc.registerFontkit(fontkit)
678
+
679
+ // Embed our custom font in the document
680
+ const customFont = await pdfDoc.embedFont(fontBytes)
681
+
682
+ // Add a blank page to the document
683
+ const page = pdfDoc.addPage()
684
+
685
+ // Create a string of text and measure its width and height in our custom font
686
+ const text = 'This is text in an embedded font!'
687
+ const textSize = 35
688
+ const textWidth = customFont.widthOfTextAtSize(text, textSize)
689
+ const textHeight = customFont.heightAtSize(textSize)
690
+
691
+ // Draw the string of text on the page
692
+ page.drawText(text, {
693
+ x: 40,
694
+ y: 450,
695
+ size: textSize,
696
+ font: customFont,
697
+ color: rgb(0, 0.53, 0.71),
698
+ })
699
+
700
+ // Draw a box around the string of text
701
+ page.drawRectangle({
702
+ x: 40,
703
+ y: 450,
704
+ width: textWidth,
705
+ height: textHeight,
706
+ borderColor: rgb(1, 0, 0),
707
+ borderWidth: 1.5,
708
+ })
709
+
710
+ // Serialize the PDFDocument to bytes (a Uint8Array)
711
+ const pdfBytes = await pdfDoc.save()
712
+
713
+ // For example, `pdfBytes` can be:
714
+ // • Written to a file in Node
715
+ // • Downloaded from the browser
716
+ // • Rendered in an <iframe>
717
+ ```
718
+
719
+ ### Add Attachments
720
+
721
+ _This example produces [this PDF](assets/pdfs/examples/add_attachments.pdf)_ (when [this image](assets/images/cat_riding_unicorn.jpg) is used for the `jpgAttachmentBytes` variable and [this PDF](assets/pdfs/us_constitution.pdf) is used for the `pdfAttachmentBytes` variable).
722
+
723
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/9snL63wj/5/)
724
+
725
+ <!-- prettier-ignore -->
726
+ ```js
727
+ import { PDFDocument } from 'pdf-lib'
728
+
729
+ // These should be Uint8Arrays or ArrayBuffers
730
+ // This data can be obtained in a number of different ways
731
+ // If your running in a Node environment, you could use fs.readFile()
732
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
733
+ const jpgAttachmentBytes = ...
734
+ const pdfAttachmentBytes = ...
735
+
736
+ // Create a new PDFDocument
737
+ const pdfDoc = await PDFDocument.create()
738
+
739
+ // Add the JPG attachment
740
+ await pdfDoc.attach(jpgAttachmentBytes, 'cat_riding_unicorn.jpg', {
741
+ mimeType: 'image/jpeg',
742
+ description: 'Cool cat riding a unicorn! 🦄🐈🕶️',
743
+ creationDate: new Date('2019/12/01'),
744
+ modificationDate: new Date('2020/04/19'),
745
+ })
746
+
747
+ // Add the PDF attachment
748
+ await pdfDoc.attach(pdfAttachmentBytes, 'us_constitution.pdf', {
749
+ mimeType: 'application/pdf',
750
+ description: 'Constitution of the United States 🇺🇸🦅',
751
+ creationDate: new Date('1787/09/17'),
752
+ modificationDate: new Date('1992/05/07'),
753
+ })
754
+
755
+ // Add a page with some text
756
+ const page = pdfDoc.addPage();
757
+ page.drawText('This PDF has two attachments', { x: 135, y: 415 })
758
+
759
+ // Serialize the PDFDocument to bytes (a Uint8Array)
760
+ const pdfBytes = await pdfDoc.save()
761
+
762
+ // For example, `pdfBytes` can be:
763
+ // • Written to a file in Node
764
+ // • Downloaded from the browser
765
+ // • Rendered in an <iframe>
766
+ ```
767
+
768
+ ### Set Document Metadata
769
+
770
+ _This example produces [this PDF](assets/pdfs/examples/set_document_metadata.pdf)_.
771
+
772
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/vcwmfnbe/2/)
773
+
774
+ <!-- prettier-ignore -->
775
+ ```js
776
+ import { PDFDocument, StandardFonts } from 'pdf-lib'
777
+
778
+ // Create a new PDFDocument
779
+ const pdfDoc = await PDFDocument.create()
780
+
781
+ // Embed the Times Roman font
782
+ const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
783
+
784
+ // Add a page and draw some text on it
785
+ const page = pdfDoc.addPage([500, 600])
786
+ page.setFont(timesRomanFont)
787
+ page.drawText('The Life of an Egg', { x: 60, y: 500, size: 50 })
788
+ page.drawText('An Epic Tale of Woe', { x: 125, y: 460, size: 25 })
789
+
790
+ // Set all available metadata fields on the PDFDocument. Note that these fields
791
+ // are visible in the "Document Properties" section of most PDF readers.
792
+ pdfDoc.setTitle('🥚 The Life of an Egg 🍳')
793
+ pdfDoc.setAuthor('Humpty Dumpty')
794
+ pdfDoc.setSubject('📘 An Epic Tale of Woe 📖')
795
+ pdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men'])
796
+ pdfDoc.setProducer('PDF App 9000 🤖')
797
+ pdfDoc.setCreator('pdf-lib (https://github.com/Hopding/pdf-lib)')
798
+ pdfDoc.setCreationDate(new Date('2018-06-24T01:58:37.228Z'))
799
+ pdfDoc.setModificationDate(new Date('2019-12-21T07:00:11.000Z'))
800
+
801
+ // Serialize the PDFDocument to bytes (a Uint8Array)
802
+ const pdfBytes = await pdfDoc.save()
803
+
804
+ // For example, `pdfBytes` can be:
805
+ // • Written to a file in Node
806
+ // • Downloaded from the browser
807
+ // • Rendered in an <iframe>
808
+ ```
809
+
810
+ ### Read Document Metadata
811
+
812
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/eg8rfz3k/16/)
813
+
814
+ <!-- prettier-ignore -->
815
+ ```js
816
+ import { PDFDocument } from 'pdf-lib'
817
+
818
+ // This should be a Uint8Array or ArrayBuffer
819
+ // This data can be obtained in a number of different ways
820
+ // If your running in a Node environment, you could use fs.readFile()
821
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
822
+ const existingPdfBytes = ...
823
+
824
+ // Load a PDFDocument without updating its existing metadata
825
+ const pdfDoc = await PDFDocument.load(existingPdfBytes, {
826
+ updateMetadata: false
827
+ })
828
+
829
+ // Print all available metadata fields
830
+ console.log('Title:', pdfDoc.getTitle())
831
+ console.log('Author:', pdfDoc.getAuthor())
832
+ console.log('Subject:', pdfDoc.getSubject())
833
+ console.log('Creator:', pdfDoc.getCreator())
834
+ console.log('Keywords:', pdfDoc.getKeywords())
835
+ console.log('Producer:', pdfDoc.getProducer())
836
+ console.log('Creation Date:', pdfDoc.getCreationDate())
837
+ console.log('Modification Date:', pdfDoc.getModificationDate())
838
+ ```
839
+
840
+ This script outputs the following (_when [this PDF](assets/pdfs/with_cropbox.pdf) is used for the `existingPdfBytes` variable_):
841
+
842
+ ```
843
+ Title: Microsoft Word - Basic Curriculum Vitae example.doc
844
+ Author: Administrator
845
+ Subject: undefined
846
+ Creator: PScript5.dll Version 5.2
847
+ Keywords: undefined
848
+ Producer: Acrobat Distiller 8.1.0 (Windows)
849
+ Creation Date: 2010-07-29T14:26:00.000Z
850
+ Modification Date: 2010-07-29T14:26:00.000Z
851
+ ```
852
+
853
+ ### Set Viewer Preferences
854
+
855
+ <!-- prettier-ignore -->
856
+ ```js
857
+ import {
858
+ PDFDocument,
859
+ StandardFonts,
860
+ NonFullScreenPageMode,
861
+ ReadingDirection,
862
+ PrintScaling,
863
+ Duplex,
864
+ PDFName,
865
+ } from 'pdf-lib'
866
+
867
+ // Create a new PDFDocument
868
+ const pdfDoc = await PDFDocument.create()
869
+
870
+ // Embed the Times Roman font
871
+ const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)
872
+
873
+ // Add a page and draw some text on it
874
+ const page = pdfDoc.addPage([500, 600])
875
+ page.setFont(timesRomanFont)
876
+ page.drawText('The Life of an Egg', { x: 60, y: 500, size: 50 })
877
+ page.drawText('An Epic Tale of Woe', { x: 125, y: 460, size: 25 })
878
+
879
+ // Set all available viewer preferences on the PDFDocument:
880
+ const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
881
+ viewerPrefs.setHideToolbar(true)
882
+ viewerPrefs.setHideMenubar(true)
883
+ viewerPrefs.setHideWindowUI(true)
884
+ viewerPrefs.setFitWindow(true)
885
+ viewerPrefs.setCenterWindow(true)
886
+ viewerPrefs.setDisplayDocTitle(true)
887
+
888
+ // Set the PageMode (otherwise setting NonFullScreenPageMode has no meaning)
889
+ pdfDoc.catalog.set(PDFName.of('PageMode'), PDFName.of('FullScreen'))
890
+
891
+ // Set what happens when fullScreen is closed
892
+ viewerPrefs.setNonFullScreenPageMode(NonFullScreenPageMode.UseOutlines)
893
+
894
+ viewerPrefs.setReadingDirection(ReadingDirection.L2R)
895
+ viewerPrefs.setPrintScaling(PrintScaling.None)
896
+ viewerPrefs.setDuplex(Duplex.DuplexFlipLongEdge)
897
+ viewerPrefs.setPickTrayByPDFSize(true)
898
+
899
+ // We can set the default print range to only the first page
900
+ viewerPrefs.setPrintPageRange({ start: 0, end: 0 })
901
+
902
+ // Or we can supply noncontiguous ranges (e.g. pages 1, 3, and 5-7)
903
+ viewerPrefs.setPrintPageRange([
904
+ { start: 0, end: 0 },
905
+ { start: 2, end: 2 },
906
+ { start: 4, end: 6 },
907
+ ])
908
+
909
+ viewerPrefs.setNumCopies(2)
910
+
911
+ // Serialize the PDFDocument to bytes (a Uint8Array)
912
+ const pdfBytes = await pdfDoc.save()
913
+
914
+ // For example, `pdfBytes` can be:
915
+ // • Written to a file in Node
916
+ // • Downloaded from the browser
917
+ // • Rendered in an <iframe>
918
+ ```
919
+
920
+ ### Read Viewer Preferences
921
+
922
+ <!-- prettier-ignore -->
923
+ ```js
924
+ import { PDFDocument } from 'pdf-lib'
925
+
926
+ // This should be a Uint8Array or ArrayBuffer
927
+ // This data can be obtained in a number of different ways
928
+ // If your running in a Node environment, you could use fs.readFile()
929
+ // In the browser, you could make a fetch() call and use res.arrayBuffer()
930
+ const existingPdfBytes = ...
931
+
932
+ // Load a PDFDocument without updating its existing metadata
933
+ const pdfDoc = await PDFDocument.load(existingPdfBytes)
934
+ const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
935
+
936
+ // Print all available viewer preference fields
937
+ console.log('HideToolbar:', viewerPrefs.getHideToolbar())
938
+ console.log('HideMenubar:', viewerPrefs.getHideMenubar())
939
+ console.log('HideWindowUI:', viewerPrefs.getHideWindowUI())
940
+ console.log('FitWindow:', viewerPrefs.getFitWindow())
941
+ console.log('CenterWindow:', viewerPrefs.getCenterWindow())
942
+ console.log('DisplayDocTitle:', viewerPrefs.getDisplayDocTitle())
943
+ console.log('NonFullScreenPageMode:', viewerPrefs.getNonFullScreenPageMode())
944
+ console.log('ReadingDirection:', viewerPrefs.getReadingDirection())
945
+ console.log('PrintScaling:', viewerPrefs.getPrintScaling())
946
+ console.log('Duplex:', viewerPrefs.getDuplex())
947
+ console.log('PickTrayByPDFSize:', viewerPrefs.getPickTrayByPDFSize())
948
+ console.log('PrintPageRange:', viewerPrefs.getPrintPageRange())
949
+ console.log('NumCopies:', viewerPrefs.getNumCopies())
950
+ ```
951
+
952
+ This script outputs the following (_when [this PDF](assets/pdfs/with_viewer_prefs.pdf) is used for the `existingPdfBytes` variable_):
953
+
954
+ ```
955
+ HideToolbar: true
956
+ HideMenubar: true
957
+ HideWindowUI: false
958
+ FitWindow: true
959
+ CenterWindow: true
960
+ DisplayDocTitle: true
961
+ NonFullScreenPageMode: UseNone
962
+ ReadingDirection: R2L
963
+ PrintScaling: None
964
+ Duplex: DuplexFlipLongEdge
965
+ PickTrayByPDFSize: true
966
+ PrintPageRange: [ { start: 1, end: 1 }, { start: 3, end: 4 } ]
967
+ NumCopies: 2
968
+ ```
969
+
970
+ ### Draw SVG Paths
971
+
972
+ _This example produces [this PDF](assets/pdfs/examples/draw_svg_paths.pdf)_.
973
+
974
+ [Try the JSFiddle demo](https://jsfiddle.net/Hopding/bwaomr9h/2/)
975
+
976
+ <!-- prettier-ignore -->
977
+ ```js
978
+ import { PDFDocument, rgb } from 'pdf-lib'
979
+
980
+ // SVG path for a wavy line
981
+ const svgPath =
982
+ 'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90'
983
+
984
+ // Create a new PDFDocument
985
+ const pdfDoc = await PDFDocument.create()
986
+
987
+ // Add a blank page to the document
988
+ const page = pdfDoc.addPage()
989
+ page.moveTo(100, page.getHeight() - 5)
990
+
991
+ // Draw the SVG path as a black line
992
+ page.moveDown(25)
993
+ page.drawSvgPath(svgPath)
994
+
995
+ // Draw the SVG path as a thick green line
996
+ page.moveDown(200)
997
+ page.drawSvgPath(svgPath, { borderColor: rgb(0, 1, 0), borderWidth: 5 })
998
+
999
+ // Draw the SVG path and fill it with red
1000
+ page.moveDown(200)
1001
+ page.drawSvgPath(svgPath, { color: rgb(1, 0, 0) })
1002
+
1003
+ // Draw the SVG path at 50% of its original size
1004
+ page.moveDown(200)
1005
+ page.drawSvgPath(svgPath, { scale: 0.5 })
1006
+
1007
+ // Serialize the PDFDocument to bytes (a Uint8Array)
1008
+ const pdfBytes = await pdfDoc.save()
1009
+
1010
+ // For example, `pdfBytes` can be:
1011
+ // • Written to a file in Node
1012
+ // • Downloaded from the browser
1013
+ // • Rendered in an <iframe>
1014
+ ```
1015
+
1016
+ ## Deno Usage
1017
+
1018
+ `pdf-lib` fully supports the exciting new [Deno](https://deno.land/) runtime! All of the [usage examples](#usage-examples) work in Deno. The only thing you need to do is change the imports for `pdf-lib` and `@pdf-lib/fontkit` to use the [Skypack](https://www.skypack.dev/) CDN, because Deno requires all modules to be referenced via URLs.
1019
+
1020
+ > **See also [How to Create and Modify PDF Files in Deno With pdf-lib](https://medium.com/swlh/how-to-create-and-modify-pdf-files-in-deno-ffaad7099b0?source=friends_link&sk=3da183bb776d059df428eaea52102f19)**
1021
+
1022
+ ### Creating a Document with Deno
1023
+
1024
+ Below is the [**create document**](#create-document) example modified for Deno:
1025
+
1026
+ ```js
1027
+ import {
1028
+ PDFDocument,
1029
+ StandardFonts,
1030
+ rgb,
1031
+ } from 'https://cdn.skypack.dev/pdf-lib@^1.11.1?dts';
1032
+
1033
+ const pdfDoc = await PDFDocument.create();
1034
+ const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman);
1035
+
1036
+ const page = pdfDoc.addPage();
1037
+ const { width, height } = page.getSize();
1038
+ const fontSize = 30;
1039
+ page.drawText('Creating PDFs in JavaScript is awesome!', {
1040
+ x: 50,
1041
+ y: height - 4 * fontSize,
1042
+ size: fontSize,
1043
+ font: timesRomanFont,
1044
+ color: rgb(0, 0.53, 0.71),
1045
+ });
1046
+
1047
+ const pdfBytes = await pdfDoc.save();
1048
+
1049
+ await Deno.writeFile('out.pdf', pdfBytes);
1050
+ ```
1051
+
1052
+ If you save this script as `create-document.ts`, you can execute it using Deno with the following command:
1053
+
1054
+ ```
1055
+ deno run --allow-write create-document.ts
1056
+ ```
1057
+
1058
+ The resulting `out.pdf` file will look like [this PDF](assets/pdfs/examples/create_document.pdf).
1059
+
1060
+ ### Embedding a Font with Deno
1061
+
1062
+ Here's a slightly more complicated example demonstrating how to embed a font and measure text in Deno:
1063
+
1064
+ ```js
1065
+ import {
1066
+ degrees,
1067
+ PDFDocument,
1068
+ rgb,
1069
+ StandardFonts,
1070
+ } from 'https://cdn.skypack.dev/pdf-lib@^1.11.1?dts';
1071
+ import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts';
1072
+
1073
+ const url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf';
1074
+ const fontBytes = await fetch(url).then((res) => res.arrayBuffer());
1075
+
1076
+ const pdfDoc = await PDFDocument.create();
1077
+
1078
+ pdfDoc.registerFontkit(fontkit);
1079
+ const customFont = await pdfDoc.embedFont(fontBytes);
1080
+
1081
+ const page = pdfDoc.addPage();
1082
+
1083
+ const text = 'This is text in an embedded font!';
1084
+ const textSize = 35;
1085
+ const textWidth = customFont.widthOfTextAtSize(text, textSize);
1086
+ const textHeight = customFont.heightAtSize(textSize);
1087
+
1088
+ page.drawText(text, {
1089
+ x: 40,
1090
+ y: 450,
1091
+ size: textSize,
1092
+ font: customFont,
1093
+ color: rgb(0, 0.53, 0.71),
1094
+ });
1095
+ page.drawRectangle({
1096
+ x: 40,
1097
+ y: 450,
1098
+ width: textWidth,
1099
+ height: textHeight,
1100
+ borderColor: rgb(1, 0, 0),
1101
+ borderWidth: 1.5,
1102
+ });
1103
+
1104
+ const pdfBytes = await pdfDoc.save();
1105
+
1106
+ await Deno.writeFile('out.pdf', pdfBytes);
1107
+ ```
1108
+
1109
+ If you save this script as `custom-font.ts`, you can execute it with the following command:
1110
+
1111
+ ```
1112
+ deno run --allow-write --allow-net custom-font.ts
1113
+ ```
1114
+
1115
+ The resulting `out.pdf` file will look like [this PDF](assets/pdfs/examples/embed_font_and_measure_text.pdf).
1116
+
1117
+ ## Complete Examples
1118
+
1119
+ The [usage examples](#usage-examples) provide code that is brief and to the point, demonstrating the different features of `pdf-lib`. You can find complete working examples in the [`apps/`](apps/) directory. These apps are used to do manual testing of `pdf-lib` before every release (in addition to the [automated tests](tests/)).
1120
+
1121
+ There are currently four apps:
1122
+
1123
+ - [**`node`**](apps/node/) - contains [tests](apps/node/tests/) for `pdf-lib` in Node environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` from the filesystem. They also allow you to quickly open your PDFs in different viewers (Acrobat, Preview, Foxit, Chrome, Firefox, etc...) to ensure compatibility.
1124
+ - [**`web`**](apps/web/) - contains [tests](apps/web/) for `pdf-lib` in browser environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` in a browser environment.
1125
+ - [**`rn`**](apps/rn) - contains [tests](apps/rn/src/tests/) for `pdf-lib` in React Native environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` in a React Native environment.
1126
+ - [**`deno`**](apps/deno) - contains [tests](apps/deno/tests/) for `pdf-lib` in Deno environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` from the filesystem.
1127
+
1128
+ ## Installation
1129
+
1130
+ ### NPM Module
1131
+
1132
+ To install the latest stable version:
1133
+
1134
+ ```bash
1135
+ # With npm
1136
+ npm install --save pdf-lib
1137
+
1138
+ # With yarn
1139
+ yarn add pdf-lib
1140
+ ```
1141
+
1142
+ This assumes you're using [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/lang/en/) as your package manager.
1143
+
1144
+ ### UMD Module
1145
+
1146
+ You can also download `pdf-lib` as a UMD module from [unpkg](https://unpkg.com/#/) or [jsDelivr](https://www.jsdelivr.com/). The UMD builds have been compiled to ES5, so they should work [in any modern browser](https://caniuse.com/#feat=es5). UMD builds are useful if you aren't using a package manager or module bundler. For example, you can use them directly in the `<script>` tag of an HTML page.
1147
+
1148
+ The following builds are available:
1149
+
1150
+ - https://unpkg.com/pdf-lib/dist/pdf-lib.js
1151
+ - https://unpkg.com/pdf-lib/dist/pdf-lib.min.js
1152
+ - https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.js
1153
+ - https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.min.js
1154
+
1155
+ > **NOTE:** if you are using the CDN scripts in production, you should include a specific version number in the URL, for example:
1156
+ >
1157
+ > - https://unpkg.com/pdf-lib@1.4.0/dist/pdf-lib.min.js
1158
+ > - https://cdn.jsdelivr.net/npm/pdf-lib@1.4.0/dist/pdf-lib.min.js
1159
+
1160
+ When using a UMD build, you will have access to a global `window.PDFLib` variable. This variable contains all of the classes and functions exported by `pdf-lib`. For example:
1161
+
1162
+ ```javascript
1163
+ // NPM module
1164
+ import { PDFDocument, rgb } from 'pdf-lib';
1165
+
1166
+ // UMD module
1167
+ var PDFDocument = PDFLib.PDFDocument;
1168
+ var rgb = PDFLib.rgb;
1169
+ ```
1170
+
1171
+ ## Fontkit Installation
1172
+
1173
+ `pdf-lib` relies upon a sister module to support embedding custom fonts: [`@pdf-lib/fontkit`](https://www.npmjs.com/package/@pdf-lib/fontkit). You must add the `@pdf-lib/fontkit` module to your project and register it using `pdfDoc.registerFontkit(...)` before embedding custom fonts (see the [font embedding example](#embed-font-and-measure-text)). This module is not included by default because not all users need it, and it increases bundle size.
1174
+
1175
+ Installing this module is easy. Just like `pdf-lib` itself, `@pdf-lib/fontkit` can be installed with `npm`/`yarn` or as a UMD module.
1176
+
1177
+ ### Fontkit NPM Module
1178
+
1179
+ ```bash
1180
+ # With npm
1181
+ npm install --save @pdf-lib/fontkit
1182
+
1183
+ # With yarn
1184
+ yarn add @pdf-lib/fontkit
1185
+ ```
1186
+
1187
+ To register the `fontkit` instance:
1188
+
1189
+ <!-- prettier-ignore -->
1190
+ ```js
1191
+ import { PDFDocument } from 'pdf-lib'
1192
+ import fontkit from '@pdf-lib/fontkit'
1193
+
1194
+ const pdfDoc = await PDFDocument.create()
1195
+ pdfDoc.registerFontkit(fontkit)
1196
+ ```
1197
+
1198
+ ### Fontkit UMD Module
1199
+
1200
+ The following builds are available:
1201
+
1202
+ - https://unpkg.com/@pdf-lib/fontkit/dist/fontkit.umd.js
1203
+ - https://unpkg.com/@pdf-lib/fontkit/dist/fontkit.umd.min.js
1204
+ - https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit/dist/fontkit.umd.js
1205
+ - https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit/dist/fontkit.umd.min.js
1206
+
1207
+ > **NOTE:** if you are using the CDN scripts in production, you should include a specific version number in the URL, for example:
1208
+ >
1209
+ > - https://unpkg.com/@pdf-lib/fontkit@0.0.4/dist/fontkit.umd.min.js
1210
+ > - https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit@0.0.4/dist/fontkit.umd.min.js
1211
+
1212
+ When using a UMD build, you will have access to a global `window.fontkit` variable. To register the `fontkit` instance:
1213
+
1214
+ <!-- prettier-ignore -->
1215
+ ```js
1216
+ var pdfDoc = await PDFLib.PDFDocument.create()
1217
+ pdfDoc.registerFontkit(fontkit)
1218
+ ```
1219
+
1220
+ ## Documentation
1221
+
1222
+ API documentation is available on the project site at https://pdf-lib.js.org/docs/api/.
1223
+
1224
+ The repo for the project site (and generated documentation files) is
1225
+ located here: https://github.com/Hopding/pdf-lib-docs.
1226
+
1227
+ ## Fonts and Unicode
1228
+
1229
+ When working with PDFs, you will frequently come across the terms "character encoding" and "font". If you have experience in web development, you may wonder why these are so prevalent. Aren't they just annoying details that you shouldn't need to worry about? Shouldn't PDF libraries and readers be able to handle all of this for you like web browsers can? Unfortunately, this is not the case. The nature of the PDF file format makes it very difficult to avoid thinking about character encodings and fonts when working with PDFs.
1230
+
1231
+ `pdf-lib` does its best to simplify things for you. But it can't perform magic. This means you should be aware of the following:
1232
+
1233
+ - **There are 14 standard fonts** defined in the PDF specification. They are as follows: _Times Roman_ (normal, bold, and italic), _Helvetica_ (normal, bold, and italic), _Courier_ (normal, bold, and italic), _ZapfDingbats_ (normal), and _Symbol_ (normal). These 14 fonts are guaranteed to be available in PDF readers. As such, you do not need to embed any font data if you wish to use one of these fonts. You can use a standard font like so:
1234
+ <!-- prettier-ignore -->
1235
+ ```js
1236
+ import { PDFDocument, StandardFonts } from 'pdf-lib'
1237
+ const pdfDoc = await PDFDocument.create()
1238
+ const courierFont = await pdfDoc.embedFont(StandardFonts.Courier)
1239
+ const page = pdfDoc.addPage()
1240
+ page.drawText('Some boring latin text in the Courier font', {
1241
+ font: courierFont,
1242
+ })
1243
+ ```
1244
+ - **The standard fonts do not support all characters** available in Unicode. The Times Roman, Helvetica, and Courier fonts use WinAnsi encoding (aka [Windows-1252](https://en.wikipedia.org/wiki/Windows-1252)). The WinAnsi character set only supports 218 characters in the Latin alphabet. For this reason, many users will find the standard fonts insufficient for their use case. This is unfortunate, but there's nothing that PDF libraries can do to change this. This is a result of the PDF specification and its age. Note that the [ZapfDingbats](https://en.wikipedia.org/wiki/Zapf_Dingbats) and [Symbol](<https://en.wikipedia.org/wiki/Symbol_(typeface)>) fonts use their own specialized encodings that support 203 and 194 characters, respectively. However, the characters they support are not useful for most use cases. See [here](assets/pdfs/standard_fonts_demo.pdf) for an example of all 14 standard fonts.
1245
+ - **You can use characters outside the Latin alphabet** by embedding your own fonts. Embedding your own font requires to you load the font data (from a file or via a network request, for example) and pass it to the `embedFont` method. When you embed your own font, you can use any Unicode characters that it supports. This capability frees you from the limitations imposed by the standard fonts. Most PDF files use embedded fonts. You can embed and use a custom font like so ([see also](#embed-font-and-measure-text)):
1246
+ <!-- prettier-ignore -->
1247
+ ```js
1248
+ import { PDFDocument } from 'pdf-lib'
1249
+ import fontkit from '@pdf-lib/fontkit'
1250
+
1251
+ const url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf'
1252
+ const fontBytes = await fetch(url).then((res) => res.arrayBuffer())
1253
+
1254
+ const pdfDoc = await PDFDocument.create()
1255
+
1256
+ pdfDoc.registerFontkit(fontkit)
1257
+ const ubuntuFont = await pdfDoc.embedFont(fontBytes)
1258
+
1259
+ const page = pdfDoc.addPage()
1260
+ page.drawText('Some fancy Unicode text in the ŪЬȕǹƚü font', {
1261
+ font: ubuntuFont,
1262
+ })
1263
+ ```
1264
+
1265
+ Note that encoding errors will be thrown if you try to use a character with a font that does not support it. For example, `Ω` is not in the WinAnsi character set. So trying to draw it on a page with the standard Helvetica font will throw the following error:
1266
+
1267
+ ```
1268
+ Error: WinAnsi cannot encode "Ω" (0x03a9)
1269
+ at Encoding.encodeUnicodeCodePoint
1270
+ ```
1271
+
1272
+ ### Font Subsetting
1273
+
1274
+ Embedding a font in a PDF document will typically increase the file's size. You can reduce the amount a file's size is increased by subsetting the font so that only the necessary characters are embedded. You can subset a font by setting the [`subset` option](https://pdf-lib.js.org/docs/api/interfaces/embedfontoptions#optional-subset) to `true`. For example:
1275
+
1276
+ ```js
1277
+ const font = await pdfDoc.embedFont(fontBytes, { subset: true });
1278
+ ```
1279
+
1280
+ Note that subsetting does not work for all fonts. See https://github.com/Hopding/pdf-lib/issues/207#issuecomment-537210471 for additional details.
1281
+
1282
+ ## Creating and Filling Forms
1283
+
1284
+ `pdf-lib` can create, fill, and read PDF form fields. The following field types are supported:
1285
+
1286
+ - [Buttons](https://pdf-lib.js.org/docs/api/classes/pdfbutton)
1287
+ - [Check Boxes](https://pdf-lib.js.org/docs/api/classes/pdfcheckbox)
1288
+ - [Dropdowns](https://pdf-lib.js.org/docs/api/classes/pdfdropdown)
1289
+ - [Option Lists](https://pdf-lib.js.org/docs/api/classes/pdfoptionlist)
1290
+ - [Radio Groups](https://pdf-lib.js.org/docs/api/classes/pdfradiogroup)
1291
+ - [Text Fields](https://pdf-lib.js.org/docs/api/classes/pdftextfield)
1292
+
1293
+ See the [form creation](#create-form) and [form filling](#fill-form) usage examples for code samples. Tests 1, 14, 15, 16, and 17 in the [complete examples](#complete-examples) contain working example code for form creation and filling in a variety of different JS environments.
1294
+
1295
+ **IMPORTANT:** The default font used to display text in buttons, dropdowns, option lists, and text fields is the standard Helvetica font. This font only supports characters in the latin alphabet (see [Fonts and Unicode](#fonts-and-unicode) for details). This means that if any of these field types are created or modified to contain text outside the latin alphabet (as is often the case), you will need to embed and use a custom font to update the field appearances. Otherwise an error will be thrown (likely when you save the `PDFDocument`).
1296
+
1297
+ You can use an embedded font when filling form fields as follows:
1298
+
1299
+ ```js
1300
+ import { PDFDocument } from 'pdf-lib';
1301
+ import fontkit from '@pdf-lib/fontkit';
1302
+
1303
+ // Fetch the PDF with form fields
1304
+ const formUrl = 'https://pdf-lib.js.org/assets/dod_character.pdf';
1305
+ const formBytes = await fetch(formUrl).then((res) => res.arrayBuffer());
1306
+
1307
+ // Fetch the Ubuntu font
1308
+ const fontUrl = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf';
1309
+ const fontBytes = await fetch(fontUrl).then((res) => res.arrayBuffer());
1310
+
1311
+ // Load the PDF with form fields
1312
+ const pdfDoc = await PDFDocument.load(formBytes);
1313
+
1314
+ // Embed the Ubuntu font
1315
+ pdfDoc.registerFontkit(fontkit);
1316
+ const ubuntuFont = await pdfDoc.embedFont(fontBytes);
1317
+
1318
+ // Get two text fields from the form
1319
+ const form = pdfDoc.getForm();
1320
+ const nameField = form.getTextField('CharacterName 2');
1321
+ const ageField = form.getTextField('Age');
1322
+
1323
+ // Fill the text fields with some fancy Unicode characters (outside
1324
+ // the WinAnsi latin character set)
1325
+ nameField.setText('Ӎӑȑїõ');
1326
+ ageField.setText('24 ŷȇȁŗš');
1327
+
1328
+ // **Key Step:** Update the field appearances with the Ubuntu font
1329
+ form.updateFieldAppearances(ubuntuFont);
1330
+
1331
+ // Save the PDF with filled form fields
1332
+ const pdfBytes = await pdfDoc.save();
1333
+ ```
1334
+
1335
+ ### Handy Methods for Filling, Creating, and Reading Form Fields
1336
+
1337
+ Existing form fields can be accessed with the following methods of [`PDFForm`](https://pdf-lib.js.org/docs/api/classes/pdfform):
1338
+
1339
+ - [`PDFForm.getButton`](https://pdf-lib.js.org/docs/api/classes/pdfform#getbutton)
1340
+ - [`PDFForm.getCheckBox`](https://pdf-lib.js.org/docs/api/classes/pdfform#getcheckbox)
1341
+ - [`PDFForm.getDropdown`](https://pdf-lib.js.org/docs/api/classes/pdfform#getdropdown)
1342
+ - [`PDFForm.getOptionList`](https://pdf-lib.js.org/docs/api/classes/pdfform#getoptionlist)
1343
+ - [`PDFForm.getRadioGroup`](https://pdf-lib.js.org/docs/api/classes/pdfform#getradiogroup)
1344
+ - [`PDFForm.getTextField`](https://pdf-lib.js.org/docs/api/classes/pdfform#gettextfield)
1345
+
1346
+ New form fields can be created with the following methods of [`PDFForm`](https://pdf-lib.js.org/docs/api/classes/pdfform):
1347
+
1348
+ - [`PDFForm.createButton`](https://pdf-lib.js.org/docs/api/classes/pdfform#createbutton)
1349
+ - [`PDFForm.createCheckBox`](https://pdf-lib.js.org/docs/api/classes/pdfform#createcheckbox)
1350
+ - [`PDFForm.createDropdown`](https://pdf-lib.js.org/docs/api/classes/pdfform#createdropdown)
1351
+ - [`PDFForm.createOptionList`](https://pdf-lib.js.org/docs/api/classes/pdfform#createoptionlist)
1352
+ - [`PDFForm.createRadioGroup`](https://pdf-lib.js.org/docs/api/classes/pdfform#createradiogroup)
1353
+ - [`PDFForm.createTextField`](https://pdf-lib.js.org/docs/api/classes/pdfform#createtextfield)
1354
+
1355
+ Below are some of the most commonly used methods for reading and filling the aforementioned subclasses of [`PDFField`](https://pdf-lib.js.org/docs/api/classes/pdffield):
1356
+
1357
+ - [`PDFCheckBox.check`](https://pdf-lib.js.org/docs/api/classes/pdfcheckbox#check)
1358
+ - [`PDFCheckBox.uncheck`](https://pdf-lib.js.org/docs/api/classes/pdfcheckbox#uncheck)
1359
+ - [`PDFCheckBox.isChecked`](https://pdf-lib.js.org/docs/api/classes/pdfcheckbox#ischecked)
1360
+
1361
+ ---
1362
+
1363
+ - [`PDFDropdown.select`](https://pdf-lib.js.org/docs/api/classes/pdfdropdown#select)
1364
+ - [`PDFDropdown.clear`](https://pdf-lib.js.org/docs/api/classes/pdfdropdown#clear)
1365
+ - [`PDFDropdown.getSelected`](https://pdf-lib.js.org/docs/api/classes/pdfdropdown#getselected)
1366
+ - [`PDFDropdown.getOptions`](https://pdf-lib.js.org/docs/api/classes/pdfdropdown#getoptions)
1367
+ - [`PDFDropdown.addOptions`](https://pdf-lib.js.org/docs/api/classes/pdfdropdown#addoptions)
1368
+
1369
+ ---
1370
+
1371
+ - [`PDFOptionList.select`](https://pdf-lib.js.org/docs/api/classes/pdfoptionlist#select)
1372
+ - [`PDFOptionList.clear`](https://pdf-lib.js.org/docs/api/classes/pdfoptionlist#clear)
1373
+ - [`PDFOptionList.getSelected`](https://pdf-lib.js.org/docs/api/classes/pdfoptionlist#getselected)
1374
+ - [`PDFOptionList.getOptions`](https://pdf-lib.js.org/docs/api/classes/pdfoptionlist#getoptions)
1375
+ - [`PDFOptionList.addOptions`](https://pdf-lib.js.org/docs/api/classes/pdfoptionlist#addoptions)
1376
+
1377
+ ---
1378
+
1379
+ - [`PDFRadioGroup.select`](https://pdf-lib.js.org/docs/api/classes/pdfradiogroup#select)
1380
+ - [`PDFRadioGroup.clear`](https://pdf-lib.js.org/docs/api/classes/pdfradiogroup#clear)
1381
+ - [`PDFRadioGroup.getSelected`](https://pdf-lib.js.org/docs/api/classes/pdfradiogroup#getselected)
1382
+ - [`PDFRadioGroup.getOptions`](https://pdf-lib.js.org/docs/api/classes/pdfradiogroup#getoptions)
1383
+ - [`PDFRadioGroup.addOptionToPage`](https://pdf-lib.js.org/docs/api/classes/pdfradiogroup#addoptiontopage)
1384
+
1385
+ ---
1386
+
1387
+ - [`PDFTextField.setText`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#settext)
1388
+ - [`PDFTextField.getText`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#gettext)
1389
+ - [`PDFTextField.setMaxLength`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#setmaxlength)
1390
+ - [`PDFTextField.getMaxLength`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#getmaxlength)
1391
+ - [`PDFTextField.removeMaxLength`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#removemaxlength)
1392
+
1393
+ ## Limitations
1394
+
1395
+ - `pdf-lib` **can** extract the content of text fields (see [`PDFTextField.getText`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#gettext)), but it **cannot** extract plain text on a page outside of a form field. This is a difficult feature to implement, but it is within the scope of this library and may be added to `pdf-lib` in the future. See
1396
+ [#93](https://github.com/Hopding/pdf-lib/issues/93),
1397
+ [#137](https://github.com/Hopding/pdf-lib/issues/137),
1398
+ [#177](https://github.com/Hopding/pdf-lib/issues/177),
1399
+ [#329](https://github.com/Hopding/pdf-lib/issues/329), and
1400
+ [#380](https://github.com/Hopding/pdf-lib/issues/380).
1401
+ - `pdf-lib` **can** remove and edit the content of text fields (see [`PDFTextField.setText`](https://pdf-lib.js.org/docs/api/classes/pdftextfield#settext)), but it does **not** provide APIs for removing or editing text on a page outside of a form field. This is also a difficult feature to implement, but is within the scope of `pdf-lib` and may be added in the future. See
1402
+ [#93](https://github.com/Hopding/pdf-lib/issues/93),
1403
+ [#137](https://github.com/Hopding/pdf-lib/issues/137),
1404
+ [#177](https://github.com/Hopding/pdf-lib/issues/177),
1405
+ [#329](https://github.com/Hopding/pdf-lib/issues/329), and
1406
+ [#380](https://github.com/Hopding/pdf-lib/issues/380).
1407
+ - `pdf-lib` does **not** support the use of HTML or CSS when adding content to a PDF. Similarly, `pdf-lib` **cannot** embed HTML/CSS content into PDFs. As convenient as such a feature might be, it would be extremely difficult to implement and is far beyond the scope of this library. If this capability is something you need, consider using [Puppeteer](https://github.com/puppeteer/puppeteer).
1408
+
1409
+ ## Help and Discussion
1410
+
1411
+ [Discussions](https://github.com/Hopding/pdf-lib/discussions) is the best place to chat with us, ask questions, and learn more about pdf-lib!
1412
+
1413
+ See also [MAINTAINERSHIP.md#communication](docs/MAINTAINERSHIP.md#communication) and [MAINTAINERSHIP.md#discord](docs/MAINTAINERSHIP.md#discord).
1414
+
1415
+ ## Encryption Handling
1416
+
1417
+ **`pdf-lib` does not currently support encrypted documents.** You should not use `pdf-lib` with encrypted documents. However, this is a feature that could be added to `pdf-lib`. Please [create an issue](https://github.com/Hopding/pdf-lib/issues/new) if you would find this feature helpful!
1418
+
1419
+ When an encrypted document is passed to `PDFDocument.load(...)`, an error will be thrown:
1420
+
1421
+ <!-- prettier-ignore -->
1422
+ ```js
1423
+ import { PDFDocument, EncryptedPDFError } from 'pdf-lib'
1424
+
1425
+ const encryptedPdfBytes = ...
1426
+
1427
+ // Assignment fails. Throws an `EncryptedPDFError`.
1428
+ const pdfDoc = PDFDocument.load(encryptedPdfBytes)
1429
+ ```
1430
+
1431
+ This default behavior is usually what you want. It allows you to easily detect if a given document is encrypted, and it prevents you from trying to modify it. However, if you really want to load the document, you can use the `{ ignoreEncryption: true }` option:
1432
+
1433
+ ```js
1434
+ import { PDFDocument } from 'pdf-lib'
1435
+
1436
+ const encryptedPdfBytes = ...
1437
+
1438
+ // Assignment succeeds. Does not throw an error.
1439
+ const pdfDoc = PDFDocument.load(encryptedPdfBytes, { ignoreEncryption: true })
1440
+ ```
1441
+
1442
+ Note that **using this option does not decrypt the document**. This means that any modifications you attempt to make on the returned `PDFDocument` may fail, or have unexpected results.
1443
+
1444
+ **You should not use this option.** It only exists for backwards compatibility reasons.
1445
+
1446
+ ## Contributing
1447
+
1448
+ We welcome contributions from the open source community! If you are interested in contributing to `pdf-lib`, please take a look at the [CONTRIBUTING.md](docs/CONTRIBUTING.md) file. It contains information to help you get `pdf-lib` setup and running on your machine. (We try to make this as simple and fast as possible! :rocket:)
1449
+
1450
+ ## Maintainership
1451
+
1452
+ Check out [MAINTAINERSHIP.md](docs/MAINTAINERSHIP.md) for details on how this repo is maintained and how we use [issues](docs/MAINTAINERSHIP.md#issues), [PRs](docs/MAINTAINERSHIP.md#pull-requests), and [discussions](docs/MAINTAINERSHIP.md#discussions).
1453
+
1454
+ ## Tutorials and Cool Stuff
1455
+
1456
+ - [labelmake](https://github.com/hand-dot/labelmake) - a library for declarative PDF generation created by @hand-dot
1457
+ - [Möbius Printing helper](https://shreevatsa.net/mobius-print/) - a tool created by @shreevatsa
1458
+ - [Extract PDF pages](https://shreevatsa.net/pdf-pages/) - a tool created by @shreevatsa
1459
+ - [Travel certificate generator](https://github.com/LAB-MI/deplacement-covid-19) - a tool that creates travel certificates for French citizens under quarantine due to COVID-19
1460
+ - [How to use pdf-lib in AWS Lambdas](https://medium.com/swlh/create-pdf-using-pdf-lib-on-serverless-aws-lambda-e9506246dc88) - a tutorial written by Crespo Wang
1461
+ - [Working With PDFs in Node.js Using pdf-lib](http://thecodebarbarian.com/working-with-pdfs-in-node-js.html) - a tutorial by Valeri Karpov
1462
+ - [Electron app for resizing PDFs](https://github.com/vegarringdal/simple-pdf-resizer) - a tool created by @vegarringdal
1463
+ - [PDF Shelter](https://pdfshelter.com) - online PDF manipulation tools by Lucas Morais
1464
+
1465
+ ## Prior Art
1466
+
1467
+ - [`pdfkit`](https://github.com/devongovett/pdfkit) is a PDF generation library for Node and the Browser. This library was immensely helpful as a reference and existence proof when creating `pdf-lib`. `pdfkit`'s code for [font embedding](src/core/embedders/CustomFontEmbedder.ts#L17-L21), [PNG embedding](src/core/embedders/PngEmbedder.ts#L7-L11), and [JPG embedding](src/core/embedders/JpegEmbedder.ts#L25-L29) was especially useful.
1468
+ - [`pdf.js`](https://github.com/mozilla/pdf.js) is a PDF rendering library for the Browser. This library was helpful as a reference when writing `pdf-lib`'s parser. Some of the code for stream decoding was [ported directly to TypeScript](src/core/streams) for use in `pdf-lib`.
1469
+ - [`pdfbox`](https://pdfbox.apache.org/) is a PDF generation and modification library written in Java. This library was an invaluable reference when implementing form creation and filling APIs for `pdf-lib`.
1470
+ - [`jspdf`](https://github.com/MrRio/jsPDF) is a PDF generation library for the browser.
1471
+ - [`pdfmake`](https://github.com/bpampuch/pdfmake) is a PDF generation library for the browser.
1472
+ - [`hummus`](https://github.com/galkahana/HummusJS) is a PDF generation and modification library for Node environments. `hummus` is a Node wrapper around a [C++ library](https://github.com/galkahana/PDF-Writer), so it doesn't work in many JavaScript environments - like the Browser or React Native.
1473
+ - [`react-native-pdf-lib`](https://github.com/Hopding/react-native-pdf-lib) is a PDF generation and modification library for React Native environments. `react-native-pdf-lib` is a wrapper around [C++](https://github.com/galkahana/PDF-Writer) and [Java](https://github.com/TomRoush/PdfBox-Android) libraries.
1474
+ - [`pdfassembler`](https://github.com/DevelopingMagic/pdfassembler) is a PDF generation and modification library for Node and the browser. It requires some knowledge about the logical structure of PDF documents to use.
1475
+
1476
+ ## Git History Rewrite
1477
+
1478
+ This repo used to contain a file called `pdf_specification.pdf` in the root directory. This was a copy of the [PDF 1.7 specification](https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf), which is made freely available by Adobe. On 8/30/2021, we received a DMCA complaint requiring us to remove the file from this repo. Simply removing the file via a new commit to `master` was insufficient to satisfy the complaint. The file needed to be completely removed from the repo's git history. Unfortunately, the file was added over two years ago, this meant we had to rewrite the repo's git history and force push to `master` 😔.
1479
+
1480
+ ### Steps We Took
1481
+
1482
+ We removed the file and rewrote the repo's history using [BFG Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/) as outlined [here](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository). For full transparency, here are the exact commands we ran:
1483
+
1484
+ ```
1485
+ $ git clone git@github.com:Hopding/pdf-lib.git
1486
+ $ cd pdf-lib
1487
+ $ rm pdf_specification.pdf
1488
+ $ git commit -am 'Remove pdf_specification.pdf'
1489
+ $ bfg --delete-files pdf_specification.pdf
1490
+ $ git reflog expire --expire=now --all && git gc --prune=now --aggressive
1491
+ $ git push --force
1492
+ ```
1493
+
1494
+ ### Why Should I Care?
1495
+
1496
+ If you're a user of `pdf-lib`, you shouldn't care! Just keep on using `pdf-lib` like normal 😃 ✨!
1497
+
1498
+ If you are a `pdf-lib` developer (meaning you've forked `pdf-lib` and/or have an open PR) then this does impact you. If you forked or cloned the repo prior to 8/30/2021 then your fork's git history is out of sync with this repo's `master` branch. Unfortunately, this will likely be a headache for you to deal with. Sorry! We didn't want to rewrite the history, but there really was no alternative.
1499
+
1500
+ It's important to note that pdf-lib's _source code_ has not changed at all. It's exactly the same as it was before the git history rewrite. The repo still has the exact same number of commits (and even the same commit contents, except for the commit that added `pdf_specification.pdf`). What has changed are the SHAs of those commits.
1501
+
1502
+ The simplest way to deal with this fact is to:
1503
+
1504
+ 1. Reclone pdf-lib
1505
+ 2. Manually copy any changes you've made from your old clone to the new one
1506
+ 3. Use your new clone going forward
1507
+ 4. Reopen your unmerged PRs using your new clone
1508
+
1509
+ See this [StackOverflow answer](https://stackoverflow.com/a/48268766) for a great, in depth explanation of what a git history rewrite entails.
1510
+
1511
+ ## License
1512
+
1513
+ [MIT](LICENSE.md)