home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1058 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  1.3 KB  |  49 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from __future__ import with_statement
  5. __license__ = 'GPL v3'
  6. __copyright__ = '2009, John Schember <john@nachtimwald.com>'
  7. __docformat__ = 'restructuredtext en'
  8. import os
  9. from pyPdf import PdfFileReader
  10.  
  11. def is_valid_pdf(pdf_path):
  12.     
  13.     try:
  14.         
  15.         try:
  16.             pdf_file = _[1]
  17.             PdfFileReader(pdf_file)
  18.         finally:
  19.             pass
  20.  
  21.     except:
  22.         return False
  23.  
  24.     return True
  25.  
  26.  
  27. def is_valid_pdfs(pdf_paths):
  28.     invalid = []
  29.     for pdf_path in pdf_paths:
  30.         if not is_valid_pdf(pdf_path):
  31.             invalid.append(pdf_path)
  32.             continue
  33.     
  34.     return invalid
  35.  
  36.  
  37. def is_encrypted(pdf_path):
  38.     
  39.     try:
  40.         pdf_file = _[1]
  41.         pdf = PdfFileReader(pdf_file)
  42.         if pdf.isEncrypted:
  43.             return True
  44.     finally:
  45.         pass
  46.  
  47.     return False
  48.  
  49.