PDF Check Fillable Fields
Determine whether a PDF has fillable form fields
Source Code
#!/usr/bin/env python3
"""Check if a PDF has fillable form fields. See forms.md."""
metadata = {
"id": "code:document.pdf.check_fillable",
"name": "PDF Check Fillable Fields",
"description": "Determine whether a PDF has fillable form fields",
"language": "python",
"packages": ["pypdf"],
"args": [
{"name": "pdf_path", "type": "string", "description": "Path to PDF file", "position": 0}
]
}
import sys
from pypdf import PdfReader
reader = PdfReader(sys.argv[1])
if (reader.get_fields()):
print("This PDF has fillable form fields")
else:
print("This PDF does not have fillable form fields; you will need to visually determine where to enter data")