This question shows research effort; it is useful and clear
2
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
現在、ディレクトリ内のどのPDFが「保護されたドキュメント」であるかを見つける必要があります。すべての pdfは保護されておらず、xpdf 経由で変換できる必要がありますが、そうではありません。ディレクトリ内のすべての PDF をスキャンして、保護されているかどうかを確認するにはどうすればよいですか?
pyPdfは PDF の復号化をサポートしています。その PdfFileReader クラスには isEncrypted属性があります。
import pyPdf
if pyPdf.PdfFileReader(open("file_name.pdf", 'rb')).isEncrypted:
print "Rut ro, it's encrypted."
# skip file? Write to a log?
else:
print "We're clear."
# Do stuff with the file.