Skip to content

Commit f90a0b8

Browse files
committed
ENH: docs: Add documentation about flattening a PDF form
1 parent b67b921 commit f90a0b8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/user/forms.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ writer.update_page_form_field_values(
3636
writer.pages[0],
3737
{"fieldname": "some filled in text"},
3838
auto_regenerate=False,
39+
flatten=False,
3940
)
4041
4142
writer.write("out-filled-form.pdf")
@@ -46,6 +47,12 @@ parameter is `True` by default for legacy compatibility, but this flags the PDF
4647
processor to recompute the field's rendering, and may trigger a "save changes"
4748
dialog for users who open the generated PDF.
4849

50+
If you want to flatten your form, that is, keeping all form field contents while
51+
removing the form fields themselves, you can set `flatten=True` to convert form
52+
field contents to regular PDF content, and then use
53+
`writer.remove_annotations(subtypes="/Widget")` to remove all form fields. This
54+
will result in a flattened PDF.
55+
4956
## Some notes about form fields and annotations
5057

5158
PDF forms have a dual-nature approach to the fields:

0 commit comments

Comments
 (0)