def test_pdf(self): shutil.copy('./tests/data/dirty.pdf', './tests/data/clean.pdf') p = pdf.PDFParser('./tests/data/clean.pdf') meta = p.get_meta() self.assertEqual(meta['producer'], 'pdfTeX-1.40.14') p.lightweight_cleaning = True ret = p.remove_all() self.assertTrue(ret) p = pdf.PDFParser('./tests/data/clean.cleaned.pdf') expected_meta = {'creation-date': -1, 'format': 'PDF-1.5', 'mod-date': -1} self.assertEqual(p.get_meta(), expected_meta) os.remove('./tests/data/clean.pdf') os.remove('./tests/data/clean.cleaned.pdf')
def test_pdf(self): p = pdf.PDFParser('./tests/data/dirty.pdf') meta = p.get_meta() self.assertEqual(meta['producer'], 'pdfTeX-1.40.14') self.assertEqual( meta['creator'], "'Certified by IEEE PDFeXpress at 03/19/2016 2:56:07 AM'") self.assertEqual(meta['DocumentID'], "uuid:4a1a79c8-404e-4d38-9580-5bc081036e61") self.assertEqual( meta['PTEX.Fullbanner'], "This is pdfTeX, Version " "3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) kpathsea " "version 6.1.1")
def test_pdf(self): shutil.copy('./tests/data/dirty.png', './tests/data/clean.png') with self.assertRaises(ValueError): pdf.PDFParser('./tests/data/clean.png') os.remove('./tests/data/clean.png')