How to Batch-Fill USCIS Immigration Packets (G-28, I-129, I-140, I-485, I-765) from CSV/JSON Without Adobe Acrobat or XFA Desync
Description and use
Automated batch‑generation of USCIS immigration packets (G‑28, I‑129, I‑140, I‑485, I‑765) from CSV/JSON, overcoming owner encryption, XFA desynchronization, and cryptic field paths.
Problem
Paralegals and immigration ops teams must re‑type identical data (petitioner FEIN, attorney bar number, beneficiary passport number, I‑94, address) thousands of times across multi‑form USCIS packets.
Outcome
Batch‑filled USCIS packets are generated from a single CSV/JSON record, removing manual re‑typing and ensuring all fields render correctly in Adobe Acrobat.
Workflow
- 1. Audit each USCIS form with pypdf and pikepdf to extract field metadata (full path, /FT, /TU, /MaxLen, /AP/N).
- 2. Build a canonical packet mapping (packet_map.json) that links canonical keys (e.g., beneficiary.family_name) to each form’s widget path.
- 3. Unlock PDFs by removing owner encryption, /Root/Perms, and /AcroForm/XFA.
- 4. For each CSV/JSON row, map values to the corresponding widget paths across all forms.
- 5. Set /V and /AS for checkboxes, clear /AP appearance streams for text fields.
- 6. Merge the modified forms into a single filing packet and export as PDF.
Evidence
Owner Encryption + /Perms Usage‑Rights Locks: 24 of 26 USCIS PDFs carry empty‑password owner encryption (modifyDenied: true) plus an Adobe /UR3 digital signature inside /Root/Perms.
Cryptic LiveCycle Subform Paths: Instead of semantic names like beneficiary_last_name, fields are nested inside XFA‑mirrored trees like form1[0].#subform[0].Pt1Line1a_FamilyName[0]—and inconsistent across forms.
Hybrid /XFA vs. /AcroForm Desynchronization: Updating /AcroForm /Fields /V without stripping /AcroForm/XFA causes Windows Adobe Acrobat to prioritize the empty <xfa:datasets> XML stream and display every populated field 100% blank.
- Record date: 2026-10-22T10:26:29.423Z