Merge v6.1.5

This commit is contained in:
James R. Barlow
2018-04-17 22:51:13 -07:00
8 changed files with 37 additions and 14 deletions
+14 -1
View File
@@ -32,6 +32,18 @@ def version():
return get_version('gs')
def jpeg_passthrough_available():
"""
Ghostscript 9.23 introduced JPEG passthrough but it seems to corrupt the
last two bytes of certain images, for now we disable it for 9.23 and
do not mention it for < 9.23.
https://bugs.ghostscript.com/show_bug.cgi?id=699216
"""
return False
def _gs_error_reported(stream):
return re.search(r'error', stream, flags=re.IGNORECASE)
@@ -133,7 +145,8 @@ def generate_pdfa(pdf_pages, output_file, compression, log,
strategy = 'RGB' if version() >= '9.19' else '/RGB'
if version() == '9.23':
# 9.23: JPEG passthrough broken for image masks?
# 9.23: new feature JPEG passthrough is broken in some cases, best to
# disable it always
# https://bugs.ghostscript.com/show_bug.cgi?id=699216
compression_args.append('-dPassThroughJPEGImages=false')
+5 -2
View File
@@ -322,8 +322,11 @@ class HocrTransform():
dy = baseline_y2 - cursor[1]
text.moveCursor(dx, dy)
text.setHorizScale(100 * box_width / font_width)
text.textOut(elemtxt)
# If reportlab tells us this word is 0 units wide, our best seems
# to be to suppress this text
if font_width > 0:
text.setHorizScale(100 * box_width / font_width)
text.textOut(elemtxt)
pdf.drawText(text)
+1
View File
@@ -143,6 +143,7 @@ def decode_pdf_date(s: str) -> datetime:
if s.startswith('D:'):
s = s[2:]
s = s.replace("'", "") # Remove apos from PDF time strings
for fmt in pdfmark_date_fmts:
try:
return datetime.strptime(s, fmt)