This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pypdf import PdfReader, PdfWriter | |
| from pypdf.generic import NameObject, NumberObject, TextStringObject, DictionaryObject, StreamObject, ArrayObject | |
| class CustomPdfWriter(PdfWriter): | |
| def flatten_form_fields(self): | |
| """ | |
| Flattens the form fields in the PDF, making them part of the content and non-editable. | |
| """ | |
| for page in self.pages: |