diff --git a/.version b/.version index 9ccca86..fcee20c 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -v1.3.10 \ No newline at end of file +v1.3.11 \ No newline at end of file diff --git a/bin/run_tests.sh b/bin/run_tests.sh index 9e34f4f..cf27132 100755 --- a/bin/run_tests.sh +++ b/bin/run_tests.sh @@ -4,10 +4,16 @@ WK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $WK_DIR cd .. -for filename in ./tests/test*.py; do - if python $filename ; then - echo woohoo - else - exit 1 - fi -done \ No newline at end of file +# for filename in ./tests/test*.py; do +# if python $filename ; then +# echo woohoo +# else +# exit 1 +# fi +# done + +if python ./test.py ; then + echo "PASSED TESTS" +else + exit 1 +fi \ No newline at end of file diff --git a/pdfmajor/__init__.py b/pdfmajor/__init__.py index 1fb70ce..28ff56b 100644 --- a/pdfmajor/__init__.py +++ b/pdfmajor/__init__.py @@ -97,7 +97,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -__version__ = (1, 3, 10) +__version__ = (1, 3, 11) if __name__ == '__main__': print( diff --git a/pdfmajor/converters/__init__.py b/pdfmajor/converters/__init__.py index 762e273..47347cc 100644 --- a/pdfmajor/converters/__init__.py +++ b/pdfmajor/converters/__init__.py @@ -22,6 +22,7 @@ def convert_file( check_extractable: bool = True, pagenos: Optional[List[int]] = None, dont_export_images: bool = False, + ignore_bad_chars: bool = False, debug_level: int = logging.WARNING, out_type: str = 'html', ): @@ -45,6 +46,7 @@ def convert_file( password=password, caching=caching, check_extractable=check_extractable, + ignore_bad_chars=ignore_bad_chars, pagenos=pagenos, debug_level=debug_level, ) @@ -59,6 +61,7 @@ def convert_file( caching=caching, check_extractable=check_extractable, pagenos=pagenos, + ignore_bad_chars=ignore_bad_chars, dont_export_images=dont_export_images, debug_level=debug_level, ) @@ -73,6 +76,7 @@ def convert_file( caching=caching, check_extractable=check_extractable, pagenos=pagenos, + ignore_bad_chars=ignore_bad_chars, dont_export_images=dont_export_images, debug_level=debug_level, ) @@ -87,6 +91,7 @@ def convert_file( caching=caching, check_extractable=check_extractable, pagenos=pagenos, + ignore_bad_chars=ignore_bad_chars, dont_export_images=dont_export_images, debug_level=debug_level, ) @@ -101,6 +106,7 @@ def convert_file( caching=caching, check_extractable=check_extractable, pagenos=pagenos, + ignore_bad_chars=ignore_bad_chars, dont_export_images=dont_export_images, debug_level=debug_level, ) diff --git a/pdfmajor/converters/html.py b/pdfmajor/converters/html.py index 41e97ed..9b8b335 100644 --- a/pdfmajor/converters/html.py +++ b/pdfmajor/converters/html.py @@ -16,6 +16,7 @@ def convert_to_html( maxpages: int = 0, password: Optional[str] = None, caching: bool = True, + ignore_bad_chars: bool = False, check_extractable: bool = True, pagenos: List[int] = None, debug_level: int = logging.WARNING, @@ -25,6 +26,7 @@ def convert_to_html( password=password, caching=caching, check_extractable=check_extractable, + ignore_bad_chars=ignore_bad_chars, pagenos=pagenos, debug_level=debug_level ) diff --git a/pdfmajor/converters/json.py b/pdfmajor/converters/json.py index 9485d7f..2e3197d 100644 --- a/pdfmajor/converters/json.py +++ b/pdfmajor/converters/json.py @@ -28,6 +28,7 @@ def convert_to_json( password: str = Optional[None], caching: bool = True, check_extractable: bool = True, + ignore_bad_chars: bool = False, pagenos: Optional[List[int]] = None, debug_level: int = logging.WARNING, ): @@ -36,6 +37,7 @@ def convert_to_json( password=password, caching=caching, check_extractable=check_extractable, + ignore_bad_chars=ignore_bad_chars, pagenos=pagenos, debug_level=debug_level ) diff --git a/pdfmajor/converters/text.py b/pdfmajor/converters/text.py index 0e50448..0da8a3c 100644 --- a/pdfmajor/converters/text.py +++ b/pdfmajor/converters/text.py @@ -14,6 +14,7 @@ def convert_to_text( password: str = None, caching: bool = True, check_extractable: bool = True, + ignore_bad_chars: bool = False, pagenos: List[int] = None, debug_level: int = logging.WARNING, ): @@ -22,6 +23,7 @@ def convert_to_text( password=password, caching=caching, check_extractable=check_extractable, + ignore_bad_chars=ignore_bad_chars, pagenos=pagenos, debug_level=debug_level ) diff --git a/pdfmajor/converters/xml.py b/pdfmajor/converters/xml.py index 40c3ca9..8aaaa26 100644 --- a/pdfmajor/converters/xml.py +++ b/pdfmajor/converters/xml.py @@ -45,6 +45,7 @@ def convert_to_xml( maxpages: int = 0, password: str = None, caching: bool = True, + ignore_bad_chars: bool = False, check_extractable: bool = True, pagenos: List[int] = None, debug_level: int = logging.WARNING, @@ -54,6 +55,7 @@ def convert_to_xml( password=password, caching=caching, check_extractable=check_extractable, + ignore_bad_chars=ignore_bad_chars, pagenos=pagenos, debug_level=debug_level ) diff --git a/pdfmajor/converters/yaml.py b/pdfmajor/converters/yaml.py index d263e05..9697958 100644 --- a/pdfmajor/converters/yaml.py +++ b/pdfmajor/converters/yaml.py @@ -28,6 +28,7 @@ def convert_to_yaml( password: str = None, caching: bool = True, check_extractable: bool = True, + ignore_bad_chars: bool = False, pagenos: List[int] = None, debug_level: int = logging.WARNING, ): @@ -36,6 +37,7 @@ def convert_to_yaml( password=password, caching=caching, check_extractable=check_extractable, + ignore_bad_chars=ignore_bad_chars, pagenos=pagenos, debug_level=debug_level ) diff --git a/setup.py b/setup.py index 7c9b7d5..4eeb34e 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ import sys with open('README.md') as readme_file: SETUP = { "name": "pdfmajor", - "version": "1.3.10", + "version": "1.3.12", "packages": find_packages(include=['pdfmajor*']), "install_requires": [ 'pycryptodome==3.8.2', diff --git a/tests/test_caching_err.py b/tests/test_caching_err.py index f1102c4..8de878f 100644 --- a/tests/test_caching_err.py +++ b/tests/test_caching_err.py @@ -14,7 +14,7 @@ NUM_LOOPS = 10 def count_elms(file_path: str): count = 0 - for page in PDFInterpreter(file_path): + for page in PDFInterpreter(file_path, ignore_bad_chars=True): for item in page: if isinstance(item, LTContainer): count += len([*item]) diff --git a/tests/test_conversions.py b/tests/test_conversions.py index d051e71..1db6e5f 100755 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -42,6 +42,7 @@ class ConversionTest(TestCase): input_file=input_file_path, output_file=output_file_path, out_type=ext, + ignore_bad_chars=True, debug_level=logging.WARN, ) if ext == 'xml': diff --git a/tests/test_interpreter.py b/tests/test_interpreter.py index e2a5fae..cf46e4b 100644 --- a/tests/test_interpreter.py +++ b/tests/test_interpreter.py @@ -16,7 +16,7 @@ class TestInterpreter(TestCase): for file_name in FILES: self.subTest(file_name=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) ) for item in page: self.assertTrue( isinstance(item, LTItem) )