Files
pdfmajor/tests/test_interpreter.py
T
2018-12-20 10:33:14 -05:00

22 lines
717 B
Python

import os
# from pdfmajor.extractor import extract_items_from_pdf
from pdfmajor.interpreter_v2 import LTCharBlock, PDFInterpreter, logging
from pdfmajor.interpreter_v2 import PageInterpreter
from pdfmajor.interpreter_v2.commands import LTItem
from pdfmajor.interpreter_v2.commands import LTCharBlock, LTChar
CUR_PATH = os.path.dirname(os.path.dirname(__file__))
FILE_NAME = os.path.join(
CUR_PATH,
"samples/pdf/tables.pdf"
)
for page in PDFInterpreter(FILE_NAME, debug_level=logging.INFO):
assert isinstance(page, PageInterpreter)
for item in page:
assert isinstance(item, LTItem)
if isinstance(item, LTCharBlock):
for char in item:
assert(char, LTChar)