Exemplo n.º 1
0
 def process(self):
     self.logger.info('Processing %s', self.filePath)
     self.logger.info('Calling Pdfinfo')
     pdfInfo = PdfInfo(self.filePath)
     self.totalPages = pdfInfo.getPages()
     self.fileSize = pdfInfo.getFileSizeInBytes()
     self.logger.info('Total Pages: %d, File Size: %d bytes', self.totalPages, self.fileSize)
     self.isEncrypted = pdfInfo.isEncrypted()
     if self.isEncrypted:
         self.writeStats()
         raise Exception('Pdf is encrypted. Can\'t do processing.')
     self.separatePdfPages()
Exemplo n.º 2
0
 def testEncryptedPdfPages(self):
     pdfInfo = PdfInfo('tests/sample-scanned-encrypted.pdf')
     pdfInfo.process()
     self.assertEqual(pdfInfo.getPages(), 69)
     self.assertEqual(pdfInfo.getFileSizeInBytes(), 1891519)
     self.assertEqual(pdfInfo.isEncrypted(), True)
Exemplo n.º 3
0
 def testPdfPages(self):
     pdfInfo = PdfInfo('tests/sample.pdf')
     pdfInfo.process()
     self.assertEqual(pdfInfo.getPages(), 5)
     self.assertEqual(pdfInfo.getFileSizeInBytes(), 81691)
     self.assertEqual(pdfInfo.isEncrypted(), False)
Exemplo n.º 4
0
 def testEncryptedPdfPages(self):
     pdfInfo = PdfInfo('tests/sample-scanned-encrypted.pdf')
     pdfInfo.process()
     self.assertEqual(pdfInfo.getPages(), 69)
     self.assertEqual(pdfInfo.getFileSizeInBytes(), 1891519)
     self.assertEqual(pdfInfo.isEncrypted(), True)
Exemplo n.º 5
0
 def testPdfPages(self):
     pdfInfo = PdfInfo('tests/sample.pdf')
     pdfInfo.process()
     self.assertEqual(pdfInfo.getPages(), 5)
     self.assertEqual(pdfInfo.getFileSizeInBytes(), 81691)
     self.assertEqual(pdfInfo.isEncrypted(), False)