from datalab_sdk import DatalabClient, FormFillingOptions
client = DatalabClient()
options = FormFillingOptions(
field_data={
"first_name": {"value": "John", "description": "First name"},
"last_name": {"value": "Doe", "description": "Last name"},
"ssn": {"value": "123-45-6789", "description": "Social Security Number"},
"address": {"value": "123 Main Street", "description": "Street address"},
"city": {"value": "Springfield", "description": "City"},
"state": {"value": "IL", "description": "State abbreviation"},
"zip": {"value": "62701", "description": "ZIP code"},
"filing_status": {"value": "Single", "description": "Filing status"},
"signature": {"value": "John Doe", "description": "Taxpayer signature"},
"date": {"value": "2024-04-15", "description": "Date signed"},
},
context="IRS W-4 Employee's Withholding Certificate"
)
result = client.fill("w4_form.pdf", options=options)
print(f"Filled {len(result.fields_filled)} fields")
print(f"Unmatched: {result.fields_not_found}")
result.save_output("w4_filled.pdf")