File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ writer.update_page_form_field_values(
3030 writer.pages[0 ],
3131 {" fieldname" : " some filled in text" },
3232 auto_regenerate = False ,
33+ flatten = False ,
3334)
3435
3536with open (" filled-out.pdf" , " wb" ) as output_stream:
@@ -41,6 +42,12 @@ parameter is `True` by default for legacy compatibility, but this flags the PDF
4142processor to recompute the field's rendering, and may trigger a "save changes"
4243dialog for users who open the generated PDF.
4344
45+ If you want to flatten your form, that is, keeping all form field contents while
46+ removing the form fields themselves, you can set ` flatten=True ` to convert form
47+ field contents to regular pdf content, and then use
48+ ` writer.remove_annotations(subtypes="/Widget") ` to remove all form fields. This
49+ will result in a flattened pdf.
50+
4451## Some notes about form fields and annotations
4552
4653PDF forms have a dual-nature approach to the fields:
You can’t perform that action at this time.
0 commit comments