Posts: 215
Threads: 55
Joined: Sep 2019
Hello,
When opening some pdf files, the following banner appears at the top:
To prevent this from appearing during the next file opening, simply click on "Enable Editing" and save the file.
I am looking for a way to automate this process by using Python. For that I need to know the attribute of the pdf file which is responsible for this "Enable Editing".
Any ideas ?
Thanks.
Posts: 12,137
Threads: 496
Joined: Sep 2016
you can read the pdf, modify and then write a new pdf with pypdf2.
Posts: 215
Threads: 55
Joined: Sep 2019
(Dec-03-2019, 12:18 PM)Larz60+ Wrote: you can read the pdf, modify and then write a new pdf with pypdf2. It was the core of my quesition: how to modify ?
What should I do once pdf is read ?
Posts: 12,137
Threads: 496
Joined: Sep 2016
Posts: 215
Threads: 55
Joined: Sep 2019
The example from your link doesn't match my case.
In that example the pdf is modified ... e.g. watermark is added.
In my case, I have nothing to modify in the file - I just have to activate editing and save the file so that the annoying banner disappears.
Posts: 2
Threads: 0
Joined: Sep 2025
Sep-26-2025, 11:23 AM
(This post was last modified: Oct-09-2025, 08:04 AM by buran.)
(Dec-03-2019, 10:36 AM)Pavel_47 Wrote: Hello,
When opening some pdf files, the following banner appears at the top:
![[Image: pdf-enable-editing-banner.jpg]](https://i.postimg.cc/FzSJ3Nrf/pdf-enable-editing-banner.jpg)
To prevent this from appearing during the next file opening, simply click on "Enable Editing" and save the file.
I am looking for a way to automate this process by using Python. For that I need to know the attribute of the pdf file which is responsible for this "Enable Editing".
Any ideas ?
Thanks.
What you’re seeing is usually caused by the PDF being marked as “Protected” or in “Protected View”, which is common for files downloaded from the internet or received via email. The banner appears because the PDF has the MarkOfTheWeb or similar security attributes. In Python, you won’t directly find an “Enable Editing” flag, but you can check and modify permissions using libraries like PyPDF2, pikepdf, or pdfplumber. Essentially, you’d need to remove restrictions or set the document permissions to allow editing, then save a new copy. This can automate the process safely.
buran write Oct-09-2025, 08:04 AM:Spam content removed
Posts: 232
Threads: 0
Joined: Jun 2019
Hi,
(Dec-03-2019, 10:36 AM)Pavel_47 Wrote: For that I need to know the attribute of the pdf file which is responsible for this "Enable Editing" It's not the attribute, it's the PDF format. As the banner says, the PDF file is saved as a PDF/A. PDF/A is an ISO-format of PDFs which are supposed for long-term preservation of the content, thus editing is disabled by default for PDF/A. See e.g. PDF/A Wikipedia article for details. For details on all PDF formats, see e.g. Adobe's documentation.
So what you basically want to do is open the file with a PDF reader / processor of your choice and write as a plain PDF file, not any of the PDF/whatever formats.
Regards, noisefloor
|