How to use the pdf2image.pdfinfo_from_bytes function in pdf2image

To help you get started, we’ve selected a few pdf2image examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Belval / pdf2image / tests.py View on Github external
def test_pdfinfo_from_bytes_invalid(self):
        start_time = time.time()
        try:
            info = pdfinfo_from_bytes(open("./tests/test.jpg", "rb").read())
            raise Exception("This should not happen")
        except PDFPageCountError:
            pass
        print("test_pdfinfo_from_path_241: {} sec".format(time.time() - start_time))
github Belval / pdf2image / tests.py View on Github external
def test_pdfinfo_from_bytes(self):
        start_time = time.time()
        info = pdfinfo_from_bytes(open("./tests/test.pdf", "rb").read())
        self.assertTrue(info.get("Pages", 0) == 1)
        print("test_pdfinfo_from_bytes: {} sec".format(time.time() - start_time))
github Belval / pdf2image / tests.py View on Github external
def test_pdfinfo_from_bytes_241(self):
        start_time = time.time()
        info = pdfinfo_from_bytes(open("./tests/test_241.pdf", "rb").read())
        self.assertTrue(info.get("Pages", 0) == 241)
        print("test_pdfinfo_from_bytes_241: {} sec".format(time.time() - start_time))