@papert-code/papert-code 0.3.95 → 0.3.96

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 (331) hide show
  1. package/README.md +13 -0
  2. package/dist/chunks/{chunk-Q5TJEKUL.js → chunk-HSYOWGEB.js} +1 -1
  3. package/dist/chunks/{chunk-KDPC3L34.js → chunk-IK4ISYCE.js} +4 -4
  4. package/dist/chunks/{chunk-JATIVKZP.js → chunk-KBPFDUTA.js} +55 -10
  5. package/dist/chunks/{chunk-DQ32BMUI.js → chunk-TNDQXJLA.js} +924 -335
  6. package/dist/chunks/{gemini-SUVKHYG5.js → gemini-MVJNXCFF.js} +3910 -1535
  7. package/dist/chunks/{openaiContentGenerator-P6VRBRRB.js → openaiContentGenerator-GTG5MK5E.js} +2 -2
  8. package/dist/chunks/{papertContentGenerator-E64QQV3K.js → papertContentGenerator-Q5TTXUE6.js} +3 -3
  9. package/dist/chunks/{server-N2U4FF55.js → server-6D3KYATG.js} +7 -1
  10. package/dist/cli.js +5 -4
  11. package/dist/sandbox-macos-permissive-proxied.sb +1 -1
  12. package/dist/sandbox-macos-restrictive-proxied.sb +1 -1
  13. package/dist/skills/algorithmic-art/SKILL.md +405 -0
  14. package/dist/skills/algorithmic-art/templates/generator_template.js +223 -0
  15. package/dist/skills/algorithmic-art/templates/viewer.html +599 -0
  16. package/dist/skills/brand-guidelines/SKILL.md +73 -0
  17. package/dist/skills/canvas-design/SKILL.md +130 -0
  18. package/dist/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  19. package/dist/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  20. package/dist/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  21. package/dist/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  22. package/dist/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  23. package/dist/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  24. package/dist/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
  25. package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  26. package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  27. package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  28. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  29. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  30. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  31. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  32. package/dist/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  33. package/dist/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
  34. package/dist/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  35. package/dist/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
  36. package/dist/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
  37. package/dist/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  38. package/dist/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
  39. package/dist/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  40. package/dist/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
  41. package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  42. package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  43. package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  44. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  45. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  46. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  47. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  48. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  49. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  50. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  51. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  52. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  53. package/dist/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  54. package/dist/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  55. package/dist/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  56. package/dist/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
  57. package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  58. package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  59. package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  60. package/dist/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
  61. package/dist/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
  62. package/dist/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  63. package/dist/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  64. package/dist/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  65. package/dist/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  66. package/dist/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  67. package/dist/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  68. package/dist/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  69. package/dist/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  70. package/dist/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
  71. package/dist/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  72. package/dist/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
  73. package/dist/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  74. package/dist/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  75. package/dist/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  76. package/dist/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  77. package/dist/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  78. package/dist/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  79. package/dist/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  80. package/dist/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  81. package/dist/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  82. package/dist/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  83. package/dist/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  84. package/dist/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  85. package/dist/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  86. package/dist/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  87. package/dist/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  88. package/dist/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  89. package/dist/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  90. package/dist/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  91. package/dist/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  92. package/dist/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
  93. package/dist/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  94. package/dist/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
  95. package/dist/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  96. package/dist/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
  97. package/dist/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  98. package/dist/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  99. package/dist/skills/doc-coauthoring/SKILL.md +375 -0
  100. package/dist/skills/docx/SKILL.md +481 -0
  101. package/dist/skills/docx/scripts/__init__.py +1 -0
  102. package/dist/skills/docx/scripts/accept_changes.py +135 -0
  103. package/dist/skills/docx/scripts/comment.py +318 -0
  104. package/dist/skills/docx/scripts/office/helpers/__init__.py +0 -0
  105. package/dist/skills/docx/scripts/office/helpers/merge_runs.py +199 -0
  106. package/dist/skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
  107. package/dist/skills/docx/scripts/office/pack.py +159 -0
  108. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  109. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  110. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  111. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  112. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  113. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  114. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  115. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  116. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  117. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  118. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  119. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  120. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  121. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  122. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  123. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  124. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  125. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  126. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  127. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  128. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  129. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  130. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  131. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  132. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  133. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  134. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  135. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  136. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  137. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  138. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  139. package/dist/skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
  140. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  141. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  142. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  143. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  144. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  145. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  146. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  147. package/dist/skills/docx/scripts/office/soffice.py +183 -0
  148. package/dist/skills/docx/scripts/office/unpack.py +132 -0
  149. package/dist/skills/docx/scripts/office/validate.py +111 -0
  150. package/dist/skills/docx/scripts/office/validators/__init__.py +15 -0
  151. package/dist/skills/docx/scripts/office/validators/base.py +847 -0
  152. package/dist/skills/docx/scripts/office/validators/docx.py +446 -0
  153. package/dist/skills/docx/scripts/office/validators/pptx.py +275 -0
  154. package/dist/skills/docx/scripts/office/validators/redlining.py +247 -0
  155. package/dist/skills/docx/scripts/templates/comments.xml +3 -0
  156. package/dist/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  157. package/dist/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  158. package/dist/skills/docx/scripts/templates/commentsIds.xml +3 -0
  159. package/dist/skills/docx/scripts/templates/people.xml +3 -0
  160. package/dist/skills/frontend-design/SKILL.md +42 -0
  161. package/dist/skills/internal-comms/SKILL.md +32 -0
  162. package/dist/skills/internal-comms/examples/3p-updates.md +47 -0
  163. package/dist/skills/internal-comms/examples/company-newsletter.md +65 -0
  164. package/dist/skills/internal-comms/examples/faq-answers.md +30 -0
  165. package/dist/skills/internal-comms/examples/general-comms.md +16 -0
  166. package/dist/skills/mcp-builder/SKILL.md +236 -0
  167. package/dist/skills/mcp-builder/reference/evaluation.md +602 -0
  168. package/dist/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  169. package/dist/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  170. package/dist/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  171. package/dist/skills/mcp-builder/scripts/connections.py +151 -0
  172. package/dist/skills/mcp-builder/scripts/evaluation.py +373 -0
  173. package/dist/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  174. package/dist/skills/mcp-builder/scripts/requirements.txt +2 -0
  175. package/dist/skills/papert-code/SKILL.md +561 -0
  176. package/dist/skills/pdf/SKILL.md +314 -0
  177. package/dist/skills/pdf/forms.md +294 -0
  178. package/dist/skills/pdf/reference.md +612 -0
  179. package/dist/skills/pdf/scripts/check_bounding_boxes.py +65 -0
  180. package/dist/skills/pdf/scripts/check_fillable_fields.py +11 -0
  181. package/dist/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
  182. package/dist/skills/pdf/scripts/create_validation_image.py +37 -0
  183. package/dist/skills/pdf/scripts/extract_form_field_info.py +122 -0
  184. package/dist/skills/pdf/scripts/extract_form_structure.py +115 -0
  185. package/dist/skills/pdf/scripts/fill_fillable_fields.py +98 -0
  186. package/dist/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  187. package/dist/skills/pptx/SKILL.md +232 -0
  188. package/dist/skills/pptx/editing.md +205 -0
  189. package/dist/skills/pptx/pptxgenjs.md +420 -0
  190. package/dist/skills/pptx/scripts/__init__.py +0 -0
  191. package/dist/skills/pptx/scripts/add_slide.py +195 -0
  192. package/dist/skills/pptx/scripts/clean.py +286 -0
  193. package/dist/skills/pptx/scripts/office/helpers/__init__.py +0 -0
  194. package/dist/skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
  195. package/dist/skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
  196. package/dist/skills/pptx/scripts/office/pack.py +159 -0
  197. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  198. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  199. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  200. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  201. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  202. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  203. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  204. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  205. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  206. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  207. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  208. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  209. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  210. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  211. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  212. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  213. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  214. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  215. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  216. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  217. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  218. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  219. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  220. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  221. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  222. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  223. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  224. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  225. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  226. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  227. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  228. package/dist/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
  229. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  230. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  231. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  232. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  233. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  234. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  235. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  236. package/dist/skills/pptx/scripts/office/soffice.py +183 -0
  237. package/dist/skills/pptx/scripts/office/unpack.py +132 -0
  238. package/dist/skills/pptx/scripts/office/validate.py +111 -0
  239. package/dist/skills/pptx/scripts/office/validators/__init__.py +15 -0
  240. package/dist/skills/pptx/scripts/office/validators/base.py +847 -0
  241. package/dist/skills/pptx/scripts/office/validators/docx.py +446 -0
  242. package/dist/skills/pptx/scripts/office/validators/pptx.py +275 -0
  243. package/dist/skills/pptx/scripts/office/validators/redlining.py +247 -0
  244. package/dist/skills/pptx/scripts/thumbnail.py +289 -0
  245. package/dist/skills/skill-creator/SKILL.md +357 -0
  246. package/dist/skills/skill-creator/references/output-patterns.md +82 -0
  247. package/dist/skills/skill-creator/references/workflows.md +28 -0
  248. package/dist/skills/skill-creator/scripts/init_skill.py +303 -0
  249. package/dist/skills/skill-creator/scripts/package_skill.py +110 -0
  250. package/dist/skills/skill-creator/scripts/quick_validate.py +103 -0
  251. package/dist/skills/slack-gif-creator/SKILL.md +254 -0
  252. package/dist/skills/slack-gif-creator/core/easing.py +234 -0
  253. package/dist/skills/slack-gif-creator/core/frame_composer.py +176 -0
  254. package/dist/skills/slack-gif-creator/core/gif_builder.py +269 -0
  255. package/dist/skills/slack-gif-creator/core/validators.py +136 -0
  256. package/dist/skills/slack-gif-creator/requirements.txt +4 -0
  257. package/dist/skills/theme-factory/SKILL.md +59 -0
  258. package/dist/skills/theme-factory/theme-showcase.pdf +0 -0
  259. package/dist/skills/theme-factory/themes/arctic-frost.md +19 -0
  260. package/dist/skills/theme-factory/themes/botanical-garden.md +19 -0
  261. package/dist/skills/theme-factory/themes/desert-rose.md +19 -0
  262. package/dist/skills/theme-factory/themes/forest-canopy.md +19 -0
  263. package/dist/skills/theme-factory/themes/golden-hour.md +19 -0
  264. package/dist/skills/theme-factory/themes/midnight-galaxy.md +19 -0
  265. package/dist/skills/theme-factory/themes/modern-minimalist.md +19 -0
  266. package/dist/skills/theme-factory/themes/ocean-depths.md +19 -0
  267. package/dist/skills/theme-factory/themes/sunset-boulevard.md +19 -0
  268. package/dist/skills/theme-factory/themes/tech-innovation.md +19 -0
  269. package/dist/skills/web-artifacts-builder/SKILL.md +74 -0
  270. package/dist/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
  271. package/dist/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
  272. package/dist/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  273. package/dist/skills/webapp-testing/SKILL.md +96 -0
  274. package/dist/skills/webapp-testing/examples/console_logging.py +35 -0
  275. package/dist/skills/webapp-testing/examples/element_discovery.py +40 -0
  276. package/dist/skills/webapp-testing/examples/static_html_automation.py +33 -0
  277. package/dist/skills/webapp-testing/scripts/with_server.py +106 -0
  278. package/dist/skills/xlsx/SKILL.md +292 -0
  279. package/dist/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
  280. package/dist/skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
  281. package/dist/skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
  282. package/dist/skills/xlsx/scripts/office/pack.py +159 -0
  283. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  284. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  285. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  286. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  287. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  288. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  289. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  290. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  291. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  292. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  293. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  294. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  295. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  296. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  297. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  298. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  299. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  300. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  301. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  302. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  303. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  304. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  305. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  306. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  307. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  308. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  309. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  310. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  311. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  312. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  313. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  314. package/dist/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
  315. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  316. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  317. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  318. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  319. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  320. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  321. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  322. package/dist/skills/xlsx/scripts/office/soffice.py +183 -0
  323. package/dist/skills/xlsx/scripts/office/unpack.py +132 -0
  324. package/dist/skills/xlsx/scripts/office/validate.py +111 -0
  325. package/dist/skills/xlsx/scripts/office/validators/__init__.py +15 -0
  326. package/dist/skills/xlsx/scripts/office/validators/base.py +847 -0
  327. package/dist/skills/xlsx/scripts/office/validators/docx.py +446 -0
  328. package/dist/skills/xlsx/scripts/office/validators/pptx.py +275 -0
  329. package/dist/skills/xlsx/scripts/office/validators/redlining.py +247 -0
  330. package/dist/skills/xlsx/scripts/recalc.py +184 -0
  331. package/package.json +5 -4
@@ -0,0 +1,314 @@
1
+ ---
2
+ name: pdf
3
+ description: Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.
4
+ license: Proprietary. LICENSE.txt has complete terms
5
+ ---
6
+
7
+ # PDF Processing Guide
8
+
9
+ ## Overview
10
+
11
+ This guide covers essential PDF processing operations using Python libraries and command-line tools. For advanced features, JavaScript libraries, and detailed examples, see REFERENCE.md. If you need to fill out a PDF form, read FORMS.md and follow its instructions.
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ from pypdf import PdfReader, PdfWriter
17
+
18
+ # Read a PDF
19
+ reader = PdfReader("document.pdf")
20
+ print(f"Pages: {len(reader.pages)}")
21
+
22
+ # Extract text
23
+ text = ""
24
+ for page in reader.pages:
25
+ text += page.extract_text()
26
+ ```
27
+
28
+ ## Python Libraries
29
+
30
+ ### pypdf - Basic Operations
31
+
32
+ #### Merge PDFs
33
+ ```python
34
+ from pypdf import PdfWriter, PdfReader
35
+
36
+ writer = PdfWriter()
37
+ for pdf_file in ["doc1.pdf", "doc2.pdf", "doc3.pdf"]:
38
+ reader = PdfReader(pdf_file)
39
+ for page in reader.pages:
40
+ writer.add_page(page)
41
+
42
+ with open("merged.pdf", "wb") as output:
43
+ writer.write(output)
44
+ ```
45
+
46
+ #### Split PDF
47
+ ```python
48
+ reader = PdfReader("input.pdf")
49
+ for i, page in enumerate(reader.pages):
50
+ writer = PdfWriter()
51
+ writer.add_page(page)
52
+ with open(f"page_{i+1}.pdf", "wb") as output:
53
+ writer.write(output)
54
+ ```
55
+
56
+ #### Extract Metadata
57
+ ```python
58
+ reader = PdfReader("document.pdf")
59
+ meta = reader.metadata
60
+ print(f"Title: {meta.title}")
61
+ print(f"Author: {meta.author}")
62
+ print(f"Subject: {meta.subject}")
63
+ print(f"Creator: {meta.creator}")
64
+ ```
65
+
66
+ #### Rotate Pages
67
+ ```python
68
+ reader = PdfReader("input.pdf")
69
+ writer = PdfWriter()
70
+
71
+ page = reader.pages[0]
72
+ page.rotate(90) # Rotate 90 degrees clockwise
73
+ writer.add_page(page)
74
+
75
+ with open("rotated.pdf", "wb") as output:
76
+ writer.write(output)
77
+ ```
78
+
79
+ ### pdfplumber - Text and Table Extraction
80
+
81
+ #### Extract Text with Layout
82
+ ```python
83
+ import pdfplumber
84
+
85
+ with pdfplumber.open("document.pdf") as pdf:
86
+ for page in pdf.pages:
87
+ text = page.extract_text()
88
+ print(text)
89
+ ```
90
+
91
+ #### Extract Tables
92
+ ```python
93
+ with pdfplumber.open("document.pdf") as pdf:
94
+ for i, page in enumerate(pdf.pages):
95
+ tables = page.extract_tables()
96
+ for j, table in enumerate(tables):
97
+ print(f"Table {j+1} on page {i+1}:")
98
+ for row in table:
99
+ print(row)
100
+ ```
101
+
102
+ #### Advanced Table Extraction
103
+ ```python
104
+ import pandas as pd
105
+
106
+ with pdfplumber.open("document.pdf") as pdf:
107
+ all_tables = []
108
+ for page in pdf.pages:
109
+ tables = page.extract_tables()
110
+ for table in tables:
111
+ if table: # Check if table is not empty
112
+ df = pd.DataFrame(table[1:], columns=table[0])
113
+ all_tables.append(df)
114
+
115
+ # Combine all tables
116
+ if all_tables:
117
+ combined_df = pd.concat(all_tables, ignore_index=True)
118
+ combined_df.to_excel("extracted_tables.xlsx", index=False)
119
+ ```
120
+
121
+ ### reportlab - Create PDFs
122
+
123
+ #### Basic PDF Creation
124
+ ```python
125
+ from reportlab.lib.pagesizes import letter
126
+ from reportlab.pdfgen import canvas
127
+
128
+ c = canvas.Canvas("hello.pdf", pagesize=letter)
129
+ width, height = letter
130
+
131
+ # Add text
132
+ c.drawString(100, height - 100, "Hello World!")
133
+ c.drawString(100, height - 120, "This is a PDF created with reportlab")
134
+
135
+ # Add a line
136
+ c.line(100, height - 140, 400, height - 140)
137
+
138
+ # Save
139
+ c.save()
140
+ ```
141
+
142
+ #### Create PDF with Multiple Pages
143
+ ```python
144
+ from reportlab.lib.pagesizes import letter
145
+ from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
146
+ from reportlab.lib.styles import getSampleStyleSheet
147
+
148
+ doc = SimpleDocTemplate("report.pdf", pagesize=letter)
149
+ styles = getSampleStyleSheet()
150
+ story = []
151
+
152
+ # Add content
153
+ title = Paragraph("Report Title", styles['Title'])
154
+ story.append(title)
155
+ story.append(Spacer(1, 12))
156
+
157
+ body = Paragraph("This is the body of the report. " * 20, styles['Normal'])
158
+ story.append(body)
159
+ story.append(PageBreak())
160
+
161
+ # Page 2
162
+ story.append(Paragraph("Page 2", styles['Heading1']))
163
+ story.append(Paragraph("Content for page 2", styles['Normal']))
164
+
165
+ # Build PDF
166
+ doc.build(story)
167
+ ```
168
+
169
+ #### Subscripts and Superscripts
170
+
171
+ **IMPORTANT**: Never use Unicode subscript/superscript characters (₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹) in ReportLab PDFs. The built-in fonts do not include these glyphs, causing them to render as solid black boxes.
172
+
173
+ Instead, use ReportLab's XML markup tags in Paragraph objects:
174
+ ```python
175
+ from reportlab.platypus import Paragraph
176
+ from reportlab.lib.styles import getSampleStyleSheet
177
+
178
+ styles = getSampleStyleSheet()
179
+
180
+ # Subscripts: use <sub> tag
181
+ chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])
182
+
183
+ # Superscripts: use <super> tag
184
+ squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])
185
+ ```
186
+
187
+ For canvas-drawn text (not Paragraph objects), manually adjust font the size and position rather than using Unicode subscripts/superscripts.
188
+
189
+ ## Command-Line Tools
190
+
191
+ ### pdftotext (poppler-utils)
192
+ ```bash
193
+ # Extract text
194
+ pdftotext input.pdf output.txt
195
+
196
+ # Extract text preserving layout
197
+ pdftotext -layout input.pdf output.txt
198
+
199
+ # Extract specific pages
200
+ pdftotext -f 1 -l 5 input.pdf output.txt # Pages 1-5
201
+ ```
202
+
203
+ ### qpdf
204
+ ```bash
205
+ # Merge PDFs
206
+ qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf
207
+
208
+ # Split pages
209
+ qpdf input.pdf --pages . 1-5 -- pages1-5.pdf
210
+ qpdf input.pdf --pages . 6-10 -- pages6-10.pdf
211
+
212
+ # Rotate pages
213
+ qpdf input.pdf output.pdf --rotate=+90:1 # Rotate page 1 by 90 degrees
214
+
215
+ # Remove password
216
+ qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf
217
+ ```
218
+
219
+ ### pdftk (if available)
220
+ ```bash
221
+ # Merge
222
+ pdftk file1.pdf file2.pdf cat output merged.pdf
223
+
224
+ # Split
225
+ pdftk input.pdf burst
226
+
227
+ # Rotate
228
+ pdftk input.pdf rotate 1east output rotated.pdf
229
+ ```
230
+
231
+ ## Common Tasks
232
+
233
+ ### Extract Text from Scanned PDFs
234
+ ```python
235
+ # Requires: pip install pytesseract pdf2image
236
+ import pytesseract
237
+ from pdf2image import convert_from_path
238
+
239
+ # Convert PDF to images
240
+ images = convert_from_path('scanned.pdf')
241
+
242
+ # OCR each page
243
+ text = ""
244
+ for i, image in enumerate(images):
245
+ text += f"Page {i+1}:\n"
246
+ text += pytesseract.image_to_string(image)
247
+ text += "\n\n"
248
+
249
+ print(text)
250
+ ```
251
+
252
+ ### Add Watermark
253
+ ```python
254
+ from pypdf import PdfReader, PdfWriter
255
+
256
+ # Create watermark (or load existing)
257
+ watermark = PdfReader("watermark.pdf").pages[0]
258
+
259
+ # Apply to all pages
260
+ reader = PdfReader("document.pdf")
261
+ writer = PdfWriter()
262
+
263
+ for page in reader.pages:
264
+ page.merge_page(watermark)
265
+ writer.add_page(page)
266
+
267
+ with open("watermarked.pdf", "wb") as output:
268
+ writer.write(output)
269
+ ```
270
+
271
+ ### Extract Images
272
+ ```bash
273
+ # Using pdfimages (poppler-utils)
274
+ pdfimages -j input.pdf output_prefix
275
+
276
+ # This extracts all images as output_prefix-000.jpg, output_prefix-001.jpg, etc.
277
+ ```
278
+
279
+ ### Password Protection
280
+ ```python
281
+ from pypdf import PdfReader, PdfWriter
282
+
283
+ reader = PdfReader("input.pdf")
284
+ writer = PdfWriter()
285
+
286
+ for page in reader.pages:
287
+ writer.add_page(page)
288
+
289
+ # Add password
290
+ writer.encrypt("userpassword", "ownerpassword")
291
+
292
+ with open("encrypted.pdf", "wb") as output:
293
+ writer.write(output)
294
+ ```
295
+
296
+ ## Quick Reference
297
+
298
+ | Task | Best Tool | Command/Code |
299
+ |------|-----------|--------------|
300
+ | Merge PDFs | pypdf | `writer.add_page(page)` |
301
+ | Split PDFs | pypdf | One page per file |
302
+ | Extract text | pdfplumber | `page.extract_text()` |
303
+ | Extract tables | pdfplumber | `page.extract_tables()` |
304
+ | Create PDFs | reportlab | Canvas or Platypus |
305
+ | Command line merge | qpdf | `qpdf --empty --pages ...` |
306
+ | OCR scanned PDFs | pytesseract | Convert to image first |
307
+ | Fill PDF forms | pdf-lib or pypdf (see FORMS.md) | See FORMS.md |
308
+
309
+ ## Next Steps
310
+
311
+ - For advanced pypdfium2 usage, see REFERENCE.md
312
+ - For JavaScript libraries (pdf-lib), see REFERENCE.md
313
+ - If you need to fill out a PDF form, follow the instructions in FORMS.md
314
+ - For troubleshooting guides, see REFERENCE.md
@@ -0,0 +1,294 @@
1
+ **CRITICAL: You MUST complete these steps in order. Do not skip ahead to writing code.**
2
+
3
+ If you need to fill out a PDF form, first check to see if the PDF has fillable form fields. Run this script from this file's directory:
4
+ `python scripts/check_fillable_fields <file.pdf>`, and depending on the result go to either the "Fillable fields" or "Non-fillable fields" and follow those instructions.
5
+
6
+ # Fillable fields
7
+ If the PDF has fillable form fields:
8
+ - Run this script from this file's directory: `python scripts/extract_form_field_info.py <input.pdf> <field_info.json>`. It will create a JSON file with a list of fields in this format:
9
+ ```
10
+ [
11
+ {
12
+ "field_id": (unique ID for the field),
13
+ "page": (page number, 1-based),
14
+ "rect": ([left, bottom, right, top] bounding box in PDF coordinates, y=0 is the bottom of the page),
15
+ "type": ("text", "checkbox", "radio_group", or "choice"),
16
+ },
17
+ // Checkboxes have "checked_value" and "unchecked_value" properties:
18
+ {
19
+ "field_id": (unique ID for the field),
20
+ "page": (page number, 1-based),
21
+ "type": "checkbox",
22
+ "checked_value": (Set the field to this value to check the checkbox),
23
+ "unchecked_value": (Set the field to this value to uncheck the checkbox),
24
+ },
25
+ // Radio groups have a "radio_options" list with the possible choices.
26
+ {
27
+ "field_id": (unique ID for the field),
28
+ "page": (page number, 1-based),
29
+ "type": "radio_group",
30
+ "radio_options": [
31
+ {
32
+ "value": (set the field to this value to select this radio option),
33
+ "rect": (bounding box for the radio button for this option)
34
+ },
35
+ // Other radio options
36
+ ]
37
+ },
38
+ // Multiple choice fields have a "choice_options" list with the possible choices:
39
+ {
40
+ "field_id": (unique ID for the field),
41
+ "page": (page number, 1-based),
42
+ "type": "choice",
43
+ "choice_options": [
44
+ {
45
+ "value": (set the field to this value to select this option),
46
+ "text": (display text of the option)
47
+ },
48
+ // Other choice options
49
+ ],
50
+ }
51
+ ]
52
+ ```
53
+ - Convert the PDF to PNGs (one image for each page) with this script (run from this file's directory):
54
+ `python scripts/convert_pdf_to_images.py <file.pdf> <output_directory>`
55
+ Then analyze the images to determine the purpose of each form field (make sure to convert the bounding box PDF coordinates to image coordinates).
56
+ - Create a `field_values.json` file in this format with the values to be entered for each field:
57
+ ```
58
+ [
59
+ {
60
+ "field_id": "last_name", // Must match the field_id from `extract_form_field_info.py`
61
+ "description": "The user's last name",
62
+ "page": 1, // Must match the "page" value in field_info.json
63
+ "value": "Simpson"
64
+ },
65
+ {
66
+ "field_id": "Checkbox12",
67
+ "description": "Checkbox to be checked if the user is 18 or over",
68
+ "page": 1,
69
+ "value": "/On" // If this is a checkbox, use its "checked_value" value to check it. If it's a radio button group, use one of the "value" values in "radio_options".
70
+ },
71
+ // more fields
72
+ ]
73
+ ```
74
+ - Run the `fill_fillable_fields.py` script from this file's directory to create a filled-in PDF:
75
+ `python scripts/fill_fillable_fields.py <input pdf> <field_values.json> <output pdf>`
76
+ This script will verify that the field IDs and values you provide are valid; if it prints error messages, correct the appropriate fields and try again.
77
+
78
+ # Non-fillable fields
79
+ If the PDF doesn't have fillable form fields, you'll add text annotations. First try to extract coordinates from the PDF structure (more accurate), then fall back to visual estimation if needed.
80
+
81
+ ## Step 1: Try Structure Extraction First
82
+
83
+ Run this script to extract text labels, lines, and checkboxes with their exact PDF coordinates:
84
+ `python scripts/extract_form_structure.py <input.pdf> form_structure.json`
85
+
86
+ This creates a JSON file containing:
87
+ - **labels**: Every text element with exact coordinates (x0, top, x1, bottom in PDF points)
88
+ - **lines**: Horizontal lines that define row boundaries
89
+ - **checkboxes**: Small square rectangles that are checkboxes (with center coordinates)
90
+ - **row_boundaries**: Row top/bottom positions calculated from horizontal lines
91
+
92
+ **Check the results**: If `form_structure.json` has meaningful labels (text elements that correspond to form fields), use **Approach A: Structure-Based Coordinates**. If the PDF is scanned/image-based and has few or no labels, use **Approach B: Visual Estimation**.
93
+
94
+ ---
95
+
96
+ ## Approach A: Structure-Based Coordinates (Preferred)
97
+
98
+ Use this when `extract_form_structure.py` found text labels in the PDF.
99
+
100
+ ### A.1: Analyze the Structure
101
+
102
+ Read form_structure.json and identify:
103
+
104
+ 1. **Label groups**: Adjacent text elements that form a single label (e.g., "Last" + "Name")
105
+ 2. **Row structure**: Labels with similar `top` values are in the same row
106
+ 3. **Field columns**: Entry areas start after label ends (x0 = label.x1 + gap)
107
+ 4. **Checkboxes**: Use the checkbox coordinates directly from the structure
108
+
109
+ **Coordinate system**: PDF coordinates where y=0 is at TOP of page, y increases downward.
110
+
111
+ ### A.2: Check for Missing Elements
112
+
113
+ The structure extraction may not detect all form elements. Common cases:
114
+ - **Circular checkboxes**: Only square rectangles are detected as checkboxes
115
+ - **Complex graphics**: Decorative elements or non-standard form controls
116
+ - **Faded or light-colored elements**: May not be extracted
117
+
118
+ If you see form fields in the PDF images that aren't in form_structure.json, you'll need to use **visual analysis** for those specific fields (see "Hybrid Approach" below).
119
+
120
+ ### A.3: Create fields.json with PDF Coordinates
121
+
122
+ For each field, calculate entry coordinates from the extracted structure:
123
+
124
+ **Text fields:**
125
+ - entry x0 = label x1 + 5 (small gap after label)
126
+ - entry x1 = next label's x0, or row boundary
127
+ - entry top = same as label top
128
+ - entry bottom = row boundary line below, or label bottom + row_height
129
+
130
+ **Checkboxes:**
131
+ - Use the checkbox rectangle coordinates directly from form_structure.json
132
+ - entry_bounding_box = [checkbox.x0, checkbox.top, checkbox.x1, checkbox.bottom]
133
+
134
+ Create fields.json using `pdf_width` and `pdf_height` (signals PDF coordinates):
135
+ ```json
136
+ {
137
+ "pages": [
138
+ {"page_number": 1, "pdf_width": 612, "pdf_height": 792}
139
+ ],
140
+ "form_fields": [
141
+ {
142
+ "page_number": 1,
143
+ "description": "Last name entry field",
144
+ "field_label": "Last Name",
145
+ "label_bounding_box": [43, 63, 87, 73],
146
+ "entry_bounding_box": [92, 63, 260, 79],
147
+ "entry_text": {"text": "Smith", "font_size": 10}
148
+ },
149
+ {
150
+ "page_number": 1,
151
+ "description": "US Citizen Yes checkbox",
152
+ "field_label": "Yes",
153
+ "label_bounding_box": [260, 200, 280, 210],
154
+ "entry_bounding_box": [285, 197, 292, 205],
155
+ "entry_text": {"text": "X"}
156
+ }
157
+ ]
158
+ }
159
+ ```
160
+
161
+ **Important**: Use `pdf_width`/`pdf_height` and coordinates directly from form_structure.json.
162
+
163
+ ### A.4: Validate Bounding Boxes
164
+
165
+ Before filling, check your bounding boxes for errors:
166
+ `python scripts/check_bounding_boxes.py fields.json`
167
+
168
+ This checks for intersecting bounding boxes and entry boxes that are too small for the font size. Fix any reported errors before filling.
169
+
170
+ ---
171
+
172
+ ## Approach B: Visual Estimation (Fallback)
173
+
174
+ Use this when the PDF is scanned/image-based and structure extraction found no usable text labels (e.g., all text shows as "(cid:X)" patterns).
175
+
176
+ ### B.1: Convert PDF to Images
177
+
178
+ `python scripts/convert_pdf_to_images.py <input.pdf> <images_dir/>`
179
+
180
+ ### B.2: Initial Field Identification
181
+
182
+ Examine each page image to identify form sections and get **rough estimates** of field locations:
183
+ - Form field labels and their approximate positions
184
+ - Entry areas (lines, boxes, or blank spaces for text input)
185
+ - Checkboxes and their approximate locations
186
+
187
+ For each field, note approximate pixel coordinates (they don't need to be precise yet).
188
+
189
+ ### B.3: Zoom Refinement (CRITICAL for accuracy)
190
+
191
+ For each field, crop a region around the estimated position to refine coordinates precisely.
192
+
193
+ **Create a zoomed crop using ImageMagick:**
194
+ ```bash
195
+ magick <page_image> -crop <width>x<height>+<x>+<y> +repage <crop_output.png>
196
+ ```
197
+
198
+ Where:
199
+ - `<x>, <y>` = top-left corner of crop region (use your rough estimate minus padding)
200
+ - `<width>, <height>` = size of crop region (field area plus ~50px padding on each side)
201
+
202
+ **Example:** To refine a "Name" field estimated around (100, 150):
203
+ ```bash
204
+ magick images_dir/page_1.png -crop 300x80+50+120 +repage crops/name_field.png
205
+ ```
206
+
207
+ (Note: if the `magick` command isn't available, try `convert` with the same arguments).
208
+
209
+ **Examine the cropped image** to determine precise coordinates:
210
+ 1. Identify the exact pixel where the entry area begins (after the label)
211
+ 2. Identify where the entry area ends (before next field or edge)
212
+ 3. Identify the top and bottom of the entry line/box
213
+
214
+ **Convert crop coordinates back to full image coordinates:**
215
+ - full_x = crop_x + crop_offset_x
216
+ - full_y = crop_y + crop_offset_y
217
+
218
+ Example: If the crop started at (50, 120) and the entry box starts at (52, 18) within the crop:
219
+ - entry_x0 = 52 + 50 = 102
220
+ - entry_top = 18 + 120 = 138
221
+
222
+ **Repeat for each field**, grouping nearby fields into single crops when possible.
223
+
224
+ ### B.4: Create fields.json with Refined Coordinates
225
+
226
+ Create fields.json using `image_width` and `image_height` (signals image coordinates):
227
+ ```json
228
+ {
229
+ "pages": [
230
+ {"page_number": 1, "image_width": 1700, "image_height": 2200}
231
+ ],
232
+ "form_fields": [
233
+ {
234
+ "page_number": 1,
235
+ "description": "Last name entry field",
236
+ "field_label": "Last Name",
237
+ "label_bounding_box": [120, 175, 242, 198],
238
+ "entry_bounding_box": [255, 175, 720, 218],
239
+ "entry_text": {"text": "Smith", "font_size": 10}
240
+ }
241
+ ]
242
+ }
243
+ ```
244
+
245
+ **Important**: Use `image_width`/`image_height` and the refined pixel coordinates from the zoom analysis.
246
+
247
+ ### B.5: Validate Bounding Boxes
248
+
249
+ Before filling, check your bounding boxes for errors:
250
+ `python scripts/check_bounding_boxes.py fields.json`
251
+
252
+ This checks for intersecting bounding boxes and entry boxes that are too small for the font size. Fix any reported errors before filling.
253
+
254
+ ---
255
+
256
+ ## Hybrid Approach: Structure + Visual
257
+
258
+ Use this when structure extraction works for most fields but misses some elements (e.g., circular checkboxes, unusual form controls).
259
+
260
+ 1. **Use Approach A** for fields that were detected in form_structure.json
261
+ 2. **Convert PDF to images** for visual analysis of missing fields
262
+ 3. **Use zoom refinement** (from Approach B) for the missing fields
263
+ 4. **Combine coordinates**: For fields from structure extraction, use `pdf_width`/`pdf_height`. For visually-estimated fields, you must convert image coordinates to PDF coordinates:
264
+ - pdf_x = image_x * (pdf_width / image_width)
265
+ - pdf_y = image_y * (pdf_height / image_height)
266
+ 5. **Use a single coordinate system** in fields.json - convert all to PDF coordinates with `pdf_width`/`pdf_height`
267
+
268
+ ---
269
+
270
+ ## Step 2: Validate Before Filling
271
+
272
+ **Always validate bounding boxes before filling:**
273
+ `python scripts/check_bounding_boxes.py fields.json`
274
+
275
+ This checks for:
276
+ - Intersecting bounding boxes (which would cause overlapping text)
277
+ - Entry boxes that are too small for the specified font size
278
+
279
+ Fix any reported errors in fields.json before proceeding.
280
+
281
+ ## Step 3: Fill the Form
282
+
283
+ The fill script auto-detects the coordinate system and handles conversion:
284
+ `python scripts/fill_pdf_form_with_annotations.py <input.pdf> fields.json <output.pdf>`
285
+
286
+ ## Step 4: Verify Output
287
+
288
+ Convert the filled PDF to images and verify text placement:
289
+ `python scripts/convert_pdf_to_images.py <output.pdf> <verify_images/>`
290
+
291
+ If text is mispositioned:
292
+ - **Approach A**: Check that you're using PDF coordinates from form_structure.json with `pdf_width`/`pdf_height`
293
+ - **Approach B**: Check that image dimensions match and coordinates are accurate pixels
294
+ - **Hybrid**: Ensure coordinate conversions are correct for visually-estimated fields