pdf-lib-enhanced 2.0.0

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