1.安装pikepdf包: pip install pikepdf
前提:能打开pdf查看
可以解除不能复制等功能
2. 代码
# pdf解密
# 1.安装pikepdf包: pip install pikepdf
import pikepdf
# opens a PDF with restrictive editing enabled, but that still
# allows printing.
def pdf_Crack(startFile,endFile):
with pikepdf.open(startFile) as pdf:
pdf.save(endFile)
return endFile
# 2.修改自己文件的位置
start = '1.pdf'
end = 'crack1.pdf'
pdf_Crack(start, end)
该博客介绍了如何利用pikepdf库来解除PDF文件的编辑限制,允许打印。通过安装pikepdf包并运行提供的代码,可以将具有编辑限制的PDF转换为可打印的版本。
647





