PdfFormState
The live values of a document's form fields, while the reader has it open.
A file's own values are what PdfFormField.value reports, and they never change. This holds what the form looks like now: what the reader typed, what a script wrote, which box is ticked. A viewer draws from it, a script reads and writes it, and io.github.yuroyami.kitepdf.writer.PdfEditor saves it.
Nothing here touches the file. Saving is a separate step, so a reader can fill a form, change its mind, and close without writing anything.
val state = PdfFormState(doc)
state.setValue("total", "42")
state.value("total") // "42"
doc.formField("total")?.value // still what the file saysA viewer keeps one for as long as the document is open, and reads revision to know when to redraw. Reads and writes are safe from two threads, because a document's scripts run on a thread of their own while the viewer draws on its own: the engine that runs the scripts is confined to one thread, but the values it writes are read by another.