Fill existing PDF templates with Python. Set up a PDF template, send data to Anvil, and get back a completed PDF — no manual entry required.
PDF_TEMPLATE_EID = "f9eQzbUgCCRVDrd4gt8b"
FILL_DATA = {
"title": "My PDF Title",
"fontSize": 10,
"textColor": "#CC0000",
"data": {
"someFieldId": "Hello World!"
}
}
def main():
anvil = Anvil(api_key=API_KEY)
print("Making fill request...")
with open(FILE_OUTPUT, "wb") as f:
f.write(res)The python-anvil package is MIT-licensed and maintained in the open on GitHub.
$ pip install python-anvilInstall the Anvil Document SDK plugin in Claude Code and Claude will scaffold the SDK into your codebase — discovery, planning, and production-ready code.
/plugin marketplace add anvilco/anvil-plugins
/plugin install anvil-document-sdk@anvil-pluginsNo API key setup needed. The plugin connects to your Anvil account with OAuth and logs you in automatically.
Instantly fill your PDF templates with JSON data. Try an example below and see documentation when ready to fill your own.