从pyPDF2中的You can use PyPDF2:from pyPDF2 import PdfFileReader, PdfFileWriterwith open("input.pdf", "rb") as in_file: input_pdf = PdfFileReader(in_file)output_pdf = PdfFileWriter()output_pdf.appendPagesFromReader(input_pdf)output_pdf.encrypt("password")with open("output.pdf", "wb") as out_file: output_pdf.write(out_file)有关更多信息,请查看 PdfFileWriter 文档.For more information, check out the PdfFileWriter docs. 这篇关于用python加密PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-22 21:49