1
from __future__ import with_statement
2
# -*- coding: utf-8 -*-
5
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
6
__docformat__ = 'restructuredtext en'
14
from pyPdf import PdfFileWriter, PdfFileReader
16
def is_valid_pdf(pdf_path):
18
Returns True if the pdf file is valid.
22
with open(os.path.abspath(pdf_path), 'rb') as pdf_file:
23
pdf = PdfFileReader(pdf_file)
28
def is_valid_pdfs(pdf_paths):
30
Returns a list of invalid pdf files.
34
for pdf_path in pdf_paths:
35
if not is_valid_pdf(pdf_path):
36
invalid.append(pdf_path)
39
def is_encrypted(pdf_path):
40
with open(os.path.abspath(pdf_path), 'rb') as pdf_file:
41
pdf = PdfFileReader(pdf_file)