Test cases / pdf
deft pdf fill
Fill a form from JSON: --data values.json
2 runs on real files, 3 tests on generated files, not shown. 0 failed.
Fixed cases
Generated files, compared with ground truth by tools other than deft.
deft pdf fill fw9.pdf --data w9-values.json -o out.pdf
Input
{"topmostSubform[0].Page1[0].f1_01[0]": "Ada Lovelace"}
What it printed
ok pdf.fill fw9.pdf -> out.pdf 1 fields 0.01s
Automatic checks (1)
- pdf_text: contains = ["Ada Lovelace"], file = "out.pdf"
deft pdf fill latex-form.pdf --data check-values.json -o out.pdf
Input
{"Name": "Ada Lovelace", "Check": true}
What it printed
ok pdf.fill latex-form.pdf -> out.pdf 2 fields 0.00s
Automatic checks (1)
- python: code = "import re, zlib; raw = open('out.pdf', 'rb').read(); parts = [m.group(1) for m in re.finditer(rb'stream\\r?\\n(.*?)endstream', raw, re.S)]; out = [];\nfor p in parts:\n try: out.append(zlib.decompress(p))\n except Exception: out.append(p)\nassert any(b' l S Q' in o for o in out)"