Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8f47768f9 | ||
|
|
c9594a4a5f | ||
|
|
079c162a96 | ||
|
|
25c8c4656f | ||
|
|
ffcae9a1a0 | ||
|
|
6e71fe1186 | ||
|
|
0885799010 | ||
|
|
8ffc99f648 |
@@ -59,23 +59,15 @@ I searched the web for a free command line tool to OCR PDF files: I found many,
|
|||||||
|
|
||||||
Linux, Windows, macOS and FreeBSD are supported. Docker images are also available.
|
Linux, Windows, macOS and FreeBSD are supported. Docker images are also available.
|
||||||
|
|
||||||
Users of Debian 9 or later or Ubuntu 16.10 or later may simply
|
| Operating system | Install command |
|
||||||
|
| ----------------------------- | ------------------------------|
|
||||||
```bash
|
| Debian, Ubuntu | ``apt install ocrmypdf`` |
|
||||||
apt-get install ocrmypdf
|
| Windows Subsystem for Linux | ``apt install ocrmypdf`` |
|
||||||
```
|
| Fedora | ``dnf install ocrmypdf`` |
|
||||||
|
| macOS | ``brew install ocrmypdf`` |
|
||||||
and users of Fedora 29 or later may simply
|
| LinuxBrew | ``brew install ocrmypdf`` |
|
||||||
|
| FreeBSD | ``pkg install py37-ocrmypdf`` |
|
||||||
```bash
|
| Conda | ``conda install ocrmypdf`` |
|
||||||
dnf install ocrmypdf
|
|
||||||
```
|
|
||||||
|
|
||||||
and Homebrew users (macOS, Linux, Windows Subsystem for Linux) may simply
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install ocrmypdf
|
|
||||||
```
|
|
||||||
|
|
||||||
For everyone else, [see our documentation](https://ocrmypdf.readthedocs.io/en/latest/installation.html) for installation steps.
|
For everyone else, [see our documentation](https://ocrmypdf.readthedocs.io/en/latest/installation.html) for installation steps.
|
||||||
|
|
||||||
|
|||||||
+27
-21
@@ -12,19 +12,21 @@ system/platform. This version may be out of date, however.
|
|||||||
|
|
||||||
These platforms have one-liner installs:
|
These platforms have one-liner installs:
|
||||||
|
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
| Debian, Ubuntu | ``apt install ocrmypdf`` |
|
| Debian, Ubuntu | ``apt install ocrmypdf`` |
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
| Windows Subsystem for Linux | ``apt install ocrmypdf`` |
|
| Windows Subsystem for Linux | ``apt install ocrmypdf`` |
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
| Fedora | ``dnf install ocrmypdf`` |
|
| Fedora | ``dnf install ocrmypdf`` |
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
| macOS | ``brew install ocrmypdf`` |
|
| macOS | ``brew install ocrmypdf`` |
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
| LinuxBrew | ``brew install ocrmypdf`` |
|
| LinuxBrew | ``brew install ocrmypdf`` |
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
| FreeBSD | ``pkg install py37-ocrmypdf`` |
|
| FreeBSD | ``pkg install py37-ocrmypdf`` |
|
||||||
+-----------------------------+-------------------------------+
|
+-------------------------------+-------------------------------+
|
||||||
|
| Conda (WSL, macOS, Linux) | ``conda install ocrmypdf`` |
|
||||||
|
+-------------------------------+-------------------------------+
|
||||||
|
|
||||||
More detailed procedures are outlined below. If you want to do a manual
|
More detailed procedures are outlined below. If you want to do a manual
|
||||||
install, or install a more recent version than your platform provides, read on.
|
install, or install a more recent version than your platform provides, read on.
|
||||||
@@ -54,6 +56,9 @@ Debian and Ubuntu 18.04 or newer
|
|||||||
.. |ubu-2004| image:: https://repology.org/badge/version-for-repo/ubuntu_20_04/ocrmypdf.svg
|
.. |ubu-2004| image:: https://repology.org/badge/version-for-repo/ubuntu_20_04/ocrmypdf.svg
|
||||||
:alt: Ubuntu 20.04 LTS
|
:alt: Ubuntu 20.04 LTS
|
||||||
|
|
||||||
|
.. |ubu-2010| image:: https://repology.org/badge/version-for-repo/ubuntu_20_10/ocrmypdf.svg
|
||||||
|
:alt: Ubuntu 20.10
|
||||||
|
|
||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
| **OCRmyPDF versions in Debian & Ubuntu** |
|
| **OCRmyPDF versions in Debian & Ubuntu** |
|
||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
@@ -61,7 +66,7 @@ Debian and Ubuntu 18.04 or newer
|
|||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
| |deb-stable| |deb-testing| |deb-unstable| |
|
| |deb-stable| |deb-testing| |deb-unstable| |
|
||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
| |ubu-1804| |ubu-2004| |
|
| |ubu-1804| |ubu-2004| |ubu-2010| |
|
||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
|
|
||||||
Users of Debian 9 ("stretch") or later, or Ubuntu 18.04 or later, including users
|
Users of Debian 9 ("stretch") or later, or Ubuntu 18.04 or later, including users
|
||||||
@@ -90,15 +95,15 @@ For full details on version availability for your platform, check the
|
|||||||
automatically detect it (specifically the ``jbig2`` binary) on the
|
automatically detect it (specifically the ``jbig2`` binary) on the
|
||||||
``PATH``. To add JBIG2 encoding, see :ref:`jbig2`.
|
``PATH``. To add JBIG2 encoding, see :ref:`jbig2`.
|
||||||
|
|
||||||
Fedora 29 or newer
|
Fedora
|
||||||
------------------
|
------
|
||||||
|
|
||||||
.. |fedora-31| image:: https://repology.org/badge/version-for-repo/fedora_31/ocrmypdf.svg
|
|
||||||
:alt: Fedora 31
|
|
||||||
|
|
||||||
.. |fedora-32| image:: https://repology.org/badge/version-for-repo/fedora_32/ocrmypdf.svg
|
.. |fedora-32| image:: https://repology.org/badge/version-for-repo/fedora_32/ocrmypdf.svg
|
||||||
:alt: Fedora 32
|
:alt: Fedora 32
|
||||||
|
|
||||||
|
.. |fedora-33| image:: https://repology.org/badge/version-for-repo/fedora_33/ocrmypdf.svg
|
||||||
|
:alt: Fedora 33
|
||||||
|
|
||||||
.. |fedora-rawhide| image:: https://repology.org/badge/version-for-repo/fedora_rawhide/ocrmypdf.svg
|
.. |fedora-rawhide| image:: https://repology.org/badge/version-for-repo/fedora_rawhide/ocrmypdf.svg
|
||||||
:alt: Fedore Rawhide
|
:alt: Fedore Rawhide
|
||||||
|
|
||||||
@@ -107,7 +112,7 @@ Fedora 29 or newer
|
|||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
| |latest| |
|
| |latest| |
|
||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
| |fedora-31| |fedora-32| |fedora-rawhide| |
|
| |fedora-32| |fedora-33| |fedora-rawhide| |
|
||||||
+-----------------------------------------------+
|
+-----------------------------------------------+
|
||||||
|
|
||||||
Users of Fedora 29 or later may simply
|
Users of Fedora 29 or later may simply
|
||||||
@@ -355,7 +360,8 @@ To install OCRmyPDF for Alpine Linux:
|
|||||||
Mageia 7
|
Mageia 7
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Install the following dependencies:
|
There is no OS-level packaging available for Mageia, so you must install the
|
||||||
|
dependencies:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,22 @@ may be unreliable. Use the API to depend on precise behavior.
|
|||||||
The public API may be useful in scripts that launch OCRmyPDF processes or that
|
The public API may be useful in scripts that launch OCRmyPDF processes or that
|
||||||
wish to use some of its features for working with PDFs.
|
wish to use some of its features for working with PDFs.
|
||||||
|
|
||||||
|
v11.7.2
|
||||||
|
=======
|
||||||
|
|
||||||
|
- Updated pinned versions in main.txt, primarily to upgrade Pillow to 8.1.2, due
|
||||||
|
to recently disclosed security vulnerabilities in that software.
|
||||||
|
- The ``--sidecar`` parameter now causes an exception if set to the same file as
|
||||||
|
the input or output PDF.
|
||||||
|
|
||||||
|
v11.7.1
|
||||||
|
=======
|
||||||
|
|
||||||
|
- Some exceptions while attempting image optimization were only logged at the debug
|
||||||
|
level, causing them to be suppressed. These errors are now logged appropriately.
|
||||||
|
- Improved the error message related to ``--unpaper-args``.
|
||||||
|
- Updated documentation to mention the new conda distribution.
|
||||||
|
|
||||||
v11.7.0
|
v11.7.0
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# requirements.txt can be used to replicate the developer's build environment
|
# requirements.txt can be used to replicate the developer's build environment
|
||||||
# setup.py lists a separate set of requirements that are looser to simplify
|
# setup.py lists a separate set of requirements that are looser to simplify
|
||||||
# installation
|
# installation
|
||||||
cffi == 1.14.3
|
cffi == 1.14.5
|
||||||
coloredlogs == 14.0 # technically optional
|
coloredlogs == 15.0 # technically optional
|
||||||
img2pdf == 0.4.0
|
img2pdf == 0.4.0
|
||||||
pdfminer.six == 20201018
|
pdfminer.six == 20201018
|
||||||
pikepdf == 2.0.0
|
pikepdf == 2.9.0
|
||||||
pluggy == 0.13.1
|
pluggy == 0.13.1
|
||||||
Pillow == 8.0.1
|
Pillow == 8.1.2
|
||||||
reportlab == 3.5.55
|
reportlab == 3.5.65
|
||||||
tqdm == 4.51.0
|
tqdm == 4.59.0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
pytest >= 5.0.0
|
pytest >= 6.0.0
|
||||||
pytest-helpers-namespace >= 2019.1.8
|
pytest-helpers-namespace >= 2019.1.8
|
||||||
pytest-xdist >= 1.31.0
|
pytest-xdist >= 2.2.0
|
||||||
pytest-cov >= 2.10.0
|
pytest-cov >= 2.11.1
|
||||||
python-xmp-toolkit == 2.0.1 # requires apt-get install libexempi3
|
python-xmp-toolkit == 2.0.1 # requires apt-get install libexempi3
|
||||||
# or brew install exempi
|
# or brew install exempi
|
||||||
#PyMuPDF == 1.13.4 # optional
|
#PyMuPDF == 1.13.4 # optional
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
watchdog == 0.10.2
|
watchdog == 1.0.2
|
||||||
|
|||||||
@@ -112,6 +112,10 @@ def check_options_sidecar(options):
|
|||||||
"--sidecar filename must be specified when output file is stdout."
|
"--sidecar filename must be specified when output file is stdout."
|
||||||
)
|
)
|
||||||
options.sidecar = options.output_file + '.txt'
|
options.sidecar = options.output_file + '.txt'
|
||||||
|
if options.sidecar == options.input_file or options.sidecar == options.output_file:
|
||||||
|
raise BadArgsError(
|
||||||
|
"--sidecar file must be different from the input and output files"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def check_options_preprocessing(options):
|
def check_options_preprocessing(options):
|
||||||
@@ -133,7 +137,7 @@ def check_options_preprocessing(options):
|
|||||||
options.unpaper_args
|
options.unpaper_args
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise BadArgsError(str(e))
|
raise BadArgsError("--unpaper-args: " + str(e)) from e
|
||||||
|
|
||||||
|
|
||||||
def _pages_from_ranges(ranges: str) -> Set[int]:
|
def _pages_from_ranges(ranges: str) -> Set[int]:
|
||||||
|
|||||||
+2
-1
@@ -167,7 +167,8 @@ Online documentation is located at:
|
|||||||
metavar='FILE',
|
metavar='FILE',
|
||||||
help="Generate sidecar text files that contain the same text recognized "
|
help="Generate sidecar text files that contain the same text recognized "
|
||||||
"by Tesseract. This may be useful for building a OCR text database. "
|
"by Tesseract. This may be useful for building a OCR text database. "
|
||||||
"If FILE is omitted, the sidecar file be named {output_file}.txt "
|
"If FILE is omitted, the sidecar file be named {output_file}.txt; the next "
|
||||||
|
"argument must NOT be the name of the input PDF. "
|
||||||
"If FILE is set to '-', the sidecar is written to stdout (a "
|
"If FILE is set to '-', the sidecar is written to stdout (a "
|
||||||
"convenient way to preview OCR quality). The output file and sidecar "
|
"convenient way to preview OCR quality). The output file and sidecar "
|
||||||
"may not both use stdout at the same time.",
|
"may not both use stdout at the same time.",
|
||||||
|
|||||||
@@ -258,8 +258,8 @@ def extract_images(
|
|||||||
result = extract_fn(
|
result = extract_fn(
|
||||||
pike=pike, root=root, image=image, xref=xref, options=options
|
pike=pike, root=root, image=image, xref=xref, options=options
|
||||||
)
|
)
|
||||||
except Exception as e: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
log.debug("Image xref %s, error %s", xref, repr(e))
|
log.exception(f"While extracting image xref {xref}, an error occurred")
|
||||||
errors += 1
|
errors += 1
|
||||||
else:
|
else:
|
||||||
if result:
|
if result:
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ from ocrmypdf.cli import get_parser
|
|||||||
from ocrmypdf.exceptions import BadArgsError, MissingDependencyError
|
from ocrmypdf.exceptions import BadArgsError, MissingDependencyError
|
||||||
from ocrmypdf.pdfinfo import PdfInfo
|
from ocrmypdf.pdfinfo import PdfInfo
|
||||||
|
|
||||||
|
run_ocrmypdf_api = pytest.helpers.run_ocrmypdf_api
|
||||||
|
|
||||||
|
|
||||||
def make_opts_pm(input_file='a.pdf', output_file='b.pdf', language='eng', **kwargs):
|
def make_opts_pm(input_file='a.pdf', output_file='b.pdf', language='eng', **kwargs):
|
||||||
if language is not None:
|
if language is not None:
|
||||||
@@ -270,3 +272,9 @@ def test_two_languages():
|
|||||||
*make_opts_pm(language='fakelang1+fakelang2'), {'fakelang1', 'fakelang2'}
|
*make_opts_pm(language='fakelang1+fakelang2'), {'fakelang1', 'fakelang2'}
|
||||||
)
|
)
|
||||||
mock.assert_called()
|
mock.assert_called()
|
||||||
|
|
||||||
|
|
||||||
|
def test_sidecar_equals_output(resources, no_outpdf):
|
||||||
|
op = no_outpdf
|
||||||
|
with pytest.raises(BadArgsError, match=r'--sidecar'):
|
||||||
|
run_ocrmypdf_api(resources / 'trivial.pdf', op, '--sidecar', op)
|
||||||
|
|||||||
Reference in New Issue
Block a user