{"id":21776,"library":"pypdfform","title":"PyPDFForm","description":"PyPDFForm is a Python library for programmatically filling, flattening, and manipulating PDF forms (AcroForms, XFA, etc.). Current version is 4.8.2, with active development and frequent releases (multiple versions per month). It supports Python >=3.10 and provides both a Python API and a CLI.","status":"active","version":"4.8.2","language":"python","source_language":"en","source_url":"https://github.com/chinapandaman/PyPDFForm","tags":["pdf","form-filling","acroform","xfa","cli"],"install":[{"cmd":"pip install pypdfform","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"As of v4.7.8, the main package moved to lib/, but the public import path remains from pypdfform.","wrong":"from pypdfform.lib import PdfWrapper","symbol":"PdfWrapper","correct":"from pypdfform import PdfWrapper"}],"quickstart":{"code":"from pypdfform import PdfWrapper\n\n# Fill a PDF form\nwith open('template.pdf', 'rb') as f:\n    pdf = PdfWrapper(f)\npdf['field_name'] = 'value'\nwith open('output.pdf', 'wb') as f:\n    f.write(pdf.read())\n\n# Flatten the form (remove interactivity)\npdf.flatten()\nwith open('output_flattened.pdf', 'wb') as f:\n    f.write(pdf.read())","lang":"python","description":"Basic usage: open a template PDF, set form field values, and write output. Use flatten() to make fields non-editable."},"warnings":[{"fix":"Use from pypdfform import PdfWrapper and avoid importing internal modules directly.","message":"In v4.7.6 - v4.7.8, the internal package structure changed, moving source to lib/. Import paths from pypdfform remain the same, but if you relied on internal modules like pypdfform.egress or pypdfform.template, those imports will break. Use public API methods instead.","severity":"breaking","affected_versions":">=4.7.6, <4.7.9"},{"fix":"Remove defer parameter usage. If you need deferred operations, use the main update_field method without defer.","message":"PdfWrapper.update_widget_key.defer parameter is deprecated since v4.7.7. It will be removed in a future version.","severity":"deprecated","affected_versions":">=4.7.7"},{"fix":"Check the widget's appearance dictionary; typically set pdf['checkbox_field'] = 'Yes' or pdf['radio_field'] = 'Choice1'.","message":"When filling checkboxes or radio buttons, use the field's export value (e.g., 'Yes' or 'On'), not a boolean True.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade to latest version: pip install --upgrade pypdfform","cause":"The internal package was restructured in v4.7.8; some users may have installed an older version that doesn't expose PdfWrapper.","error":"ImportError: cannot import name 'PdfWrapper' from 'pypdfform'"},{"fix":"List all field names: pdf = PdfWrapper('template.pdf'); print(list(pdf.keys()))","cause":"The field name does not exist in the PDF form. PyPDFForm uses the original field names from the PDF.","error":"KeyError: 'field_name'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}