How can I encrypt the document so it is not allowed to edit text or should not allow copying content from pdf files?
I tried setting different user and admin passwords but still, I was able to edit the text in pdf editor.
import pikepdf
from pikepdf import Pdf
pdf = Pdf.open("document.pdf")
pdf.save('output_filename.pdf', encryption=pikepdf.Encryption(owner="password", user="123", R=6))
pdf.close()
Basically if there is way without password if I can encrypt document to edit than that will well and good. Thanks in Advance.
You need to PyPDF2 (pip install PyPDF2) for using this script. And try this:
Here details for PyPDF2: https://pythonhosted.org/PyPDF2/PdfFileWriter.html