Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7b7ca0574 | ||
|
|
17ac9d7a9a |
+13
-1
@@ -13,6 +13,18 @@ Note that it is licensed under GPLv3, so scripts that
|
|||||||
``import ocrmypdf`` and are released publicly should probably also be
|
``import ocrmypdf`` and are released publicly should probably also be
|
||||||
licensed under GPLv3.
|
licensed under GPLv3.
|
||||||
|
|
||||||
|
v9.0.3
|
||||||
|
======
|
||||||
|
|
||||||
|
- Embed an encoded version of the sRGB ICC profile in the intermediate
|
||||||
|
Postscript file (used for PDF/A conversion). Previously we included the
|
||||||
|
filename, which required Postscript to run with file access enabled. For
|
||||||
|
security, Ghostscript 9.28 enables ``-dSAFER`` and as such, no longer
|
||||||
|
permits access to any file by default. This fix is necessary for
|
||||||
|
compatibility with Ghostscript 9.28.
|
||||||
|
- Exclude a test that sometimes times out and fails in continuous integration
|
||||||
|
from the standard test suite.
|
||||||
|
|
||||||
v9.0.2
|
v9.0.2
|
||||||
======
|
======
|
||||||
|
|
||||||
@@ -23,7 +35,7 @@ v9.0.2
|
|||||||
- Fixed an issue that caused inversion of black and white in monochrome images.
|
- Fixed an issue that caused inversion of black and white in monochrome images.
|
||||||
We are not certain but the problem seems to be linked to Leptonica 1.76.0 and
|
We are not certain but the problem seems to be linked to Leptonica 1.76.0 and
|
||||||
older.
|
older.
|
||||||
- Fixed some cases where the test suite failed or produced unexpected if
|
- Fixed some cases where the test suite failed if
|
||||||
English or German Tesseract language packs were not installed.
|
English or German Tesseract language packs were not installed.
|
||||||
- Fixed a runtime error if the Tesseract English language is not installed.
|
- Fixed a runtime error if the Tesseract English language is not installed.
|
||||||
- Improved explicit closing of Pillow images after use.
|
- Improved explicit closing of Pillow images after use.
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ def generate_pdfa(
|
|||||||
"-dQUIET",
|
"-dQUIET",
|
||||||
"-dBATCH",
|
"-dBATCH",
|
||||||
"-dNOPAUSE",
|
"-dNOPAUSE",
|
||||||
|
"-dSAFER",
|
||||||
"-dCompatibilityLevel=" + str(pdf_version),
|
"-dCompatibilityLevel=" + str(pdf_version),
|
||||||
"-sDEVICE=pdfwrite",
|
"-sDEVICE=pdfwrite",
|
||||||
"-dAutoRotatePages=/None",
|
"-dAutoRotatePages=/None",
|
||||||
|
|||||||
+7
-14
@@ -31,6 +31,7 @@ Ghostscript's handling of pdfmark.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import base64
|
||||||
import os
|
import os
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -48,12 +49,10 @@ SRGB_ICC_PROFILE = pkg_resources.resource_filename('ocrmypdf', ICC_PROFILE_RELPA
|
|||||||
# files, from the Ghostscript documentation. Lines beginning with % are
|
# files, from the Ghostscript documentation. Lines beginning with % are
|
||||||
# comments. Python substitution variables have a '$' prefix.
|
# comments. Python substitution variables have a '$' prefix.
|
||||||
pdfa_def_template = u"""%!
|
pdfa_def_template = u"""%!
|
||||||
% Define entries in the document Info dictionary :
|
% Define an ICC profile :
|
||||||
/ICCProfile $icc_profile
|
/ICCProfile $icc_profile
|
||||||
def
|
def
|
||||||
|
|
||||||
% Define an ICC profile :
|
|
||||||
|
|
||||||
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
|
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
|
||||||
[{icc_PDFA}
|
[{icc_PDFA}
|
||||||
<<
|
<<
|
||||||
@@ -67,7 +66,7 @@ def
|
|||||||
(ERROR, unable to determine ProcessColorModel) == flush
|
(ERROR, unable to determine ProcessColorModel) == flush
|
||||||
} ifelse
|
} ifelse
|
||||||
>> /PUT pdfmark
|
>> /PUT pdfmark
|
||||||
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
|
[{icc_PDFA} ICCProfile /PUT pdfmark
|
||||||
|
|
||||||
% Define the output intent dictionary :
|
% Define the output intent dictionary :
|
||||||
|
|
||||||
@@ -104,16 +103,10 @@ def generate_pdfa_ps(target_filename, icc='sRGB'):
|
|||||||
else:
|
else:
|
||||||
raise NotImplementedError("Only supporting sRGB")
|
raise NotImplementedError("Only supporting sRGB")
|
||||||
|
|
||||||
# pdfmark must contain the full path to the ICC profile, and pdfmark must be
|
# Read the ICC profile, encode as ASCII85 and convert to a string which we
|
||||||
# also encoded in ASCII. ocrmypdf can be installed anywhere, including to
|
# will insert in the .ps file
|
||||||
# paths that have a non-ASCII character in the filename. Ghostscript
|
bytes_icc_profile = Path(icc_profile).read_bytes()
|
||||||
# accepts hex-encoded strings and converts them to byte strings, so
|
icc_profile = base64.a85encode(bytes_icc_profile, adobe=True).decode('ascii')
|
||||||
# we encode the path with fsencode() and use the hex representation.
|
|
||||||
# UTF-16 not accepted here. (Even though ASCII encodable is the usual case,
|
|
||||||
# do this always to avoid making it a rare conditional.)
|
|
||||||
bytes_icc_profile = os.fsencode(icc_profile)
|
|
||||||
hex_icc_profile = hexlify(bytes_icc_profile)
|
|
||||||
icc_profile = '<' + hex_icc_profile.decode('ascii') + '>'
|
|
||||||
|
|
||||||
t = Template(pdfa_def_template)
|
t = Template(pdfa_def_template)
|
||||||
ps = t.substitute(icc_profile=icc_profile, icc_identifier=icc)
|
ps = t.substitute(icc_profile=icc_profile, icc_identifier=icc)
|
||||||
|
|||||||
@@ -613,6 +613,7 @@ language_model_penalty_non_freq_dict_word 0
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow # This test sometimes times out in CI
|
||||||
@pytest.mark.parametrize('renderer', RENDERERS)
|
@pytest.mark.parametrize('renderer', RENDERERS)
|
||||||
def test_tesseract_config_notfound(renderer, resources, outdir):
|
def test_tesseract_config_notfound(renderer, resources, outdir):
|
||||||
cfg_file = outdir / 'nofile.cfg'
|
cfg_file = outdir / 'nofile.cfg'
|
||||||
|
|||||||
Reference in New Issue
Block a user