v1.3.12
This commit is contained in:
1 parent
36a9371657
commit
152d3aaf55
13 files changed
+35
-12
No files matched your search
+13
-7
@@ -4,10 +4,16 @@ WK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
cd $WK_DIR
|
cd $WK_DIR
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
for filename in ./tests/test*.py; do
|
# for filename in ./tests/test*.py; do
|
||||||
if python $filename ; then
|
# if python $filename ; then
|
||||||
echo woohoo
|
# echo woohoo
|
||||||
else
|
# else
|
||||||
exit 1
|
# exit 1
|
||||||
fi
|
# fi
|
||||||
done
|
# done
|
||||||
|
|
||||||
|
if python ./test.py ; then
|
||||||
|
echo "PASSED TESTS"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -97,7 +97,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__version__ = (1, 3, 10)
|
__version__ = (1, 3, 11)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(
|
print(
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ def convert_file(
|
|||||||
check_extractable: bool = True,
|
check_extractable: bool = True,
|
||||||
pagenos: Optional[List[int]] = None,
|
pagenos: Optional[List[int]] = None,
|
||||||
dont_export_images: bool = False,
|
dont_export_images: bool = False,
|
||||||
|
ignore_bad_chars: bool = False,
|
||||||
debug_level: int = logging.WARNING,
|
debug_level: int = logging.WARNING,
|
||||||
out_type: str = 'html',
|
out_type: str = 'html',
|
||||||
):
|
):
|
||||||
@@ -45,6 +46,7 @@ def convert_file(
|
|||||||
password=password,
|
password=password,
|
||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
debug_level=debug_level,
|
debug_level=debug_level,
|
||||||
)
|
)
|
||||||
@@ -59,6 +61,7 @@ def convert_file(
|
|||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
dont_export_images=dont_export_images,
|
dont_export_images=dont_export_images,
|
||||||
debug_level=debug_level,
|
debug_level=debug_level,
|
||||||
)
|
)
|
||||||
@@ -73,6 +76,7 @@ def convert_file(
|
|||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
dont_export_images=dont_export_images,
|
dont_export_images=dont_export_images,
|
||||||
debug_level=debug_level,
|
debug_level=debug_level,
|
||||||
)
|
)
|
||||||
@@ -87,6 +91,7 @@ def convert_file(
|
|||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
dont_export_images=dont_export_images,
|
dont_export_images=dont_export_images,
|
||||||
debug_level=debug_level,
|
debug_level=debug_level,
|
||||||
)
|
)
|
||||||
@@ -101,6 +106,7 @@ def convert_file(
|
|||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
dont_export_images=dont_export_images,
|
dont_export_images=dont_export_images,
|
||||||
debug_level=debug_level,
|
debug_level=debug_level,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ def convert_to_html(
|
|||||||
maxpages: int = 0,
|
maxpages: int = 0,
|
||||||
password: Optional[str] = None,
|
password: Optional[str] = None,
|
||||||
caching: bool = True,
|
caching: bool = True,
|
||||||
|
ignore_bad_chars: bool = False,
|
||||||
check_extractable: bool = True,
|
check_extractable: bool = True,
|
||||||
pagenos: List[int] = None,
|
pagenos: List[int] = None,
|
||||||
debug_level: int = logging.WARNING,
|
debug_level: int = logging.WARNING,
|
||||||
@@ -25,6 +26,7 @@ def convert_to_html(
|
|||||||
password=password,
|
password=password,
|
||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
debug_level=debug_level
|
debug_level=debug_level
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ def convert_to_json(
|
|||||||
password: str = Optional[None],
|
password: str = Optional[None],
|
||||||
caching: bool = True,
|
caching: bool = True,
|
||||||
check_extractable: bool = True,
|
check_extractable: bool = True,
|
||||||
|
ignore_bad_chars: bool = False,
|
||||||
pagenos: Optional[List[int]] = None,
|
pagenos: Optional[List[int]] = None,
|
||||||
debug_level: int = logging.WARNING,
|
debug_level: int = logging.WARNING,
|
||||||
):
|
):
|
||||||
@@ -36,6 +37,7 @@ def convert_to_json(
|
|||||||
password=password,
|
password=password,
|
||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
debug_level=debug_level
|
debug_level=debug_level
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ def convert_to_text(
|
|||||||
password: str = None,
|
password: str = None,
|
||||||
caching: bool = True,
|
caching: bool = True,
|
||||||
check_extractable: bool = True,
|
check_extractable: bool = True,
|
||||||
|
ignore_bad_chars: bool = False,
|
||||||
pagenos: List[int] = None,
|
pagenos: List[int] = None,
|
||||||
debug_level: int = logging.WARNING,
|
debug_level: int = logging.WARNING,
|
||||||
):
|
):
|
||||||
@@ -22,6 +23,7 @@ def convert_to_text(
|
|||||||
password=password,
|
password=password,
|
||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
debug_level=debug_level
|
debug_level=debug_level
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ def convert_to_xml(
|
|||||||
maxpages: int = 0,
|
maxpages: int = 0,
|
||||||
password: str = None,
|
password: str = None,
|
||||||
caching: bool = True,
|
caching: bool = True,
|
||||||
|
ignore_bad_chars: bool = False,
|
||||||
check_extractable: bool = True,
|
check_extractable: bool = True,
|
||||||
pagenos: List[int] = None,
|
pagenos: List[int] = None,
|
||||||
debug_level: int = logging.WARNING,
|
debug_level: int = logging.WARNING,
|
||||||
@@ -54,6 +55,7 @@ def convert_to_xml(
|
|||||||
password=password,
|
password=password,
|
||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
debug_level=debug_level
|
debug_level=debug_level
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ def convert_to_yaml(
|
|||||||
password: str = None,
|
password: str = None,
|
||||||
caching: bool = True,
|
caching: bool = True,
|
||||||
check_extractable: bool = True,
|
check_extractable: bool = True,
|
||||||
|
ignore_bad_chars: bool = False,
|
||||||
pagenos: List[int] = None,
|
pagenos: List[int] = None,
|
||||||
debug_level: int = logging.WARNING,
|
debug_level: int = logging.WARNING,
|
||||||
):
|
):
|
||||||
@@ -36,6 +37,7 @@ def convert_to_yaml(
|
|||||||
password=password,
|
password=password,
|
||||||
caching=caching,
|
caching=caching,
|
||||||
check_extractable=check_extractable,
|
check_extractable=check_extractable,
|
||||||
|
ignore_bad_chars=ignore_bad_chars,
|
||||||
pagenos=pagenos,
|
pagenos=pagenos,
|
||||||
debug_level=debug_level
|
debug_level=debug_level
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import sys
|
|||||||
with open('README.md') as readme_file:
|
with open('README.md') as readme_file:
|
||||||
SETUP = {
|
SETUP = {
|
||||||
"name": "pdfmajor",
|
"name": "pdfmajor",
|
||||||
"version": "1.3.10",
|
"version": "1.3.12",
|
||||||
"packages": find_packages(include=['pdfmajor*']),
|
"packages": find_packages(include=['pdfmajor*']),
|
||||||
"install_requires": [
|
"install_requires": [
|
||||||
'pycryptodome==3.8.2',
|
'pycryptodome==3.8.2',
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ NUM_LOOPS = 10
|
|||||||
|
|
||||||
def count_elms(file_path: str):
|
def count_elms(file_path: str):
|
||||||
count = 0
|
count = 0
|
||||||
for page in PDFInterpreter(file_path):
|
for page in PDFInterpreter(file_path, ignore_bad_chars=True):
|
||||||
for item in page:
|
for item in page:
|
||||||
if isinstance(item, LTContainer):
|
if isinstance(item, LTContainer):
|
||||||
count += len([*item])
|
count += len([*item])
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class ConversionTest(TestCase):
|
|||||||
input_file=input_file_path,
|
input_file=input_file_path,
|
||||||
output_file=output_file_path,
|
output_file=output_file_path,
|
||||||
out_type=ext,
|
out_type=ext,
|
||||||
|
ignore_bad_chars=True,
|
||||||
debug_level=logging.WARN,
|
debug_level=logging.WARN,
|
||||||
)
|
)
|
||||||
if ext == 'xml':
|
if ext == 'xml':
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class TestInterpreter(TestCase):
|
|||||||
for file_name in FILES:
|
for file_name in FILES:
|
||||||
self.subTest(file_name=file_name)
|
self.subTest(file_name=file_name)
|
||||||
file_path = os.path.join(INPUT_FOLDER, file_name)
|
file_path = os.path.join(INPUT_FOLDER, file_name)
|
||||||
for page in PDFInterpreter(file_path, debug_level=logging.ERROR):
|
for page in PDFInterpreter(file_path, debug_level=logging.ERROR, ignore_bad_chars=True):
|
||||||
self.assertTrue( isinstance(page, PageInterpreter) )
|
self.assertTrue( isinstance(page, PageInterpreter) )
|
||||||
for item in page:
|
for item in page:
|
||||||
self.assertTrue( isinstance(item, LTItem) )
|
self.assertTrue( isinstance(item, LTItem) )
|
||||||
|
|||||||
Reference in new issue
Block a user