mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2025-12-29 08:01:04 +00:00
Merge branch 'feature/drop-mupdf-poppler' into develop
This commit is contained in:
commit
6ac7ffd77b
@ -41,12 +41,14 @@ Changes
|
||||
- GNU parallel_
|
||||
- ImageMagick_
|
||||
- Python 2.7
|
||||
- Poppler
|
||||
- MuPDF_ tools
|
||||
- shell scripts
|
||||
|
||||
- Some new external dependencies are required:
|
||||
|
||||
- MuPDF_ tools
|
||||
- Ghostscript 9.14+
|
||||
- qpdf 5.0.0+
|
||||
- Unpaper_ 6.1 (optional)
|
||||
- some automatically managed Python dependencies
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ import PyPDF2 as pypdf
|
||||
from PIL import Image
|
||||
|
||||
from subprocess import Popen, check_call, PIPE, CalledProcessError, \
|
||||
TimeoutExpired
|
||||
TimeoutExpired, check_output
|
||||
try:
|
||||
from subprocess import DEVNULL
|
||||
except ImportError:
|
||||
@ -319,11 +319,10 @@ def repair_pdf(
|
||||
log,
|
||||
pdfinfo,
|
||||
pdfinfo_lock):
|
||||
args_mutool = [
|
||||
'mutool', 'clean',
|
||||
input_file, output_file
|
||||
args_qpdf = [
|
||||
'qpdf', input_file, output_file
|
||||
]
|
||||
check_call(args_mutool)
|
||||
check_call(args_qpdf)
|
||||
|
||||
with pdfinfo_lock:
|
||||
pdfinfo.extend(pdf_get_all_pageinfo(output_file))
|
||||
@ -388,12 +387,17 @@ def split_pages(
|
||||
for oo in output_files:
|
||||
with suppress(FileNotFoundError):
|
||||
os.unlink(oo)
|
||||
args_pdfseparate = [
|
||||
'pdfseparate',
|
||||
input_file,
|
||||
os.path.join(work_folder, '%06d.page.pdf')
|
||||
]
|
||||
check_call(args_pdfseparate)
|
||||
|
||||
pages = check_output(['qpdf', '--show-npages', input_file],
|
||||
universal_newlines=True, close_fds=True)
|
||||
|
||||
for n in range(int(pages)):
|
||||
args_qpdf = [
|
||||
'qpdf', input_file,
|
||||
'--pages', input_file, '{0}'.format(n + 1), '--',
|
||||
os.path.join(work_folder, '{0:06d}.page.pdf'.format(n + 1))
|
||||
]
|
||||
check_call(args_qpdf)
|
||||
|
||||
from glob import glob
|
||||
for filename in glob(os.path.join(work_folder, '*.page.pdf')):
|
||||
|
||||
16
setup.py
16
setup.py
@ -150,13 +150,6 @@ if command.startswith('install') or \
|
||||
package='unpaper',
|
||||
optional=True
|
||||
)
|
||||
# Deprecated
|
||||
check_external_program(
|
||||
program='pdfseparate',
|
||||
need_version='0.29.0',
|
||||
package='poppler',
|
||||
version_check_args=['-v']
|
||||
)
|
||||
check_external_program(
|
||||
program='java',
|
||||
need_version='1.5.0',
|
||||
@ -164,11 +157,10 @@ if command.startswith('install') or \
|
||||
version_check_args=['-version']
|
||||
)
|
||||
check_external_program(
|
||||
program='mutool',
|
||||
need_version='1.7',
|
||||
version_check_args=['-v'],
|
||||
version_scrape_regex=re.compile(r'(\d+\.\d+[a-z]*)'),
|
||||
package='mupdf-tools'
|
||||
program='qpdf',
|
||||
need_version='5.0.0',
|
||||
package='qpdf',
|
||||
version_check_args=['--version']
|
||||
)
|
||||
|
||||
setup(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user