问题
Is there any python module using that we can create a new pdf file or modify the existing pdf file which have only read permission. I want to disable the "Save as" and "Save as to other formats" for the pdf file.(DRM things.)
回答1:
I'm not sure this is portable, but you could use os.chmod:
import os
from stat import S_IREAD, S_IRGRP, S_IROTH
filename = "yourfile.pdf"
# Open the file and write your stuff to the file etc...
os.chmod(filename, S_IREAD|S_IRGRP|S_IROTH)
Thanks to: Change file to read-only mode in Python
来源:https://stackoverflow.com/questions/41362682/creating-read-only-pdf-file-using-python