Forms · Go

Create and fill PDF forms in Go

Build interactive AcroForm fields from Go (text inputs, checkboxes, radio groups and dropdowns) with generated appearance streams, then fill and flatten them later. No NeedAppearances hack required.

Last updated: 2026-06-29

Why Go needs this

Onboarding flows, applications and consent screens built in Go frequently end in a filled PDF, but AcroForm fields that render in one viewer and vanish in another, the dreaded NeedAppearances flag, are a classic source of support tickets that Go's ecosystem gives you no clean way to avoid.

rust-pdf bakes an appearance stream into every text field, checkbox, radio group and dropdown, so they display correctly everywhere without the NeedAppearances hack. Dotted names give you a hierarchy for grouped data, and an existing form can be filled by name and flattened into non-editable static content.

This fits an HTTP form flow naturally: bind a POST body in an Echo or net/http handler, set each field by its dotted name, and flatten before returning the PDF so the submitted values are locked in. Errors come back as values, so a typo in a field name is handled cleanly rather than crashing the request.

  • Text fields, checkboxes, radio groups and dropdowns with generated appearance streams.
  • Hierarchical dotted field names for grouped data.
  • Fill an existing form and flatten it into non-editable content.

Build a form in Go with rust-pdf

Install with go get, then call the same idiomatic API every rust-pdf binding shares. The snippet below is real Go code from the reference docs.

go get github.com/rustpdf/rustpdf-go

Go
doc, _ := rustpdf.New()
defer doc.Close()
_ = doc.AddPage()
_ = doc.TextField("applicant.name", 0, [4]float64{72, 700, 320, 720}, "", 0)
_ = doc.Checkbox("agree", 0, [4]float64{72, 660, 88, 676}, false)
_ = doc.Dropdown("plan", 0, [4]float64{72, 620, 240, 640},
	[]string{"Starter", "Pro", "Enterprise"}, 1, 0)
_ = doc.RadioGroup("billing", 0, []rustpdf.RadioButton{
	{Rect: [4]float64{72, 580, 88, 596}, Export: "monthly"},
	{Rect: [4]float64{140, 580, 156, 596}, Export: "annual"},
}, 1)
_ = doc.Save("form.pdf")
Validated by: qpdfmutool

This is part of the free tier in Go. No license required.

Full Go reference in the documentation.

Forms in Go: FAQ

Do the form fields render without NeedAppearances in Go?

Yes. rust-pdf generates an appearance stream for every field, so checkboxes, text and choices display correctly in all viewers without the NeedAppearances workaround.

Can I fill an existing form in Go?

Yes. Load the PDF, set text fields, checkboxes, radios and dropdowns by name, and optionally flatten the form so the values become permanent static content.

Is form authoring free?

Yes. Creating, filling and flattening AcroForm fields is part of the free tier in Go.

Can I fill a form from HTTP request data in Go?

Yes. Bind the incoming POST body in an Echo or net/http handler, set each field by its name on the loaded form, then flatten so the submitted values become static content. The dotted field names map cleanly onto nested request structs, and a bad field name returns an error rather than panicking.

Bring interactive forms to your Go app

One Rust core, the same form rendering in every language. Creating, filling and flattening AcroForms is free in Go. No license required.