Fill existing PDF templates with C# & .NET. Set up a PDF template, send data to Anvil, and get back a completed PDF — no manual entry required.
class FillPDF: RunnableBaseExample {
private Anvil.Payloads.Request.FillPdf GetFillData() {
return new Anvil.Payloads.Request.FillPdf {
Title = "My PDF Title",
FontSize = 10,
TextColor = "#333333",
Data = new Dictionary < string, dynamic > () {
{ "shortText", "HELLOOW"},
{ "date", "2022-07-08" },
{ "name", new Dictionary < string, object > () {
{ "firstName", "Robin" },
{ "mi", "W" },
{ "lastName", "Smith" }
}
},
{ "email", "testy@example.com" }
}
};
}
public override async Task Run(string apiKey) {
var pdfTemplateEid = "f9eQzbUgCCRVDrd4gt8b";
var payload = GetFillData();
var client = new RestClient(apiKey);
var wasWritten = await client.FillPdf(pdfTemplateEid, payload, "./output/fill-output.pdf");
}
}
The Anvil.Client package is MIT-licensed and maintained in the open on GitHub.
$ dotnet add package Anvil.ClientInstall 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.