Fixed blank pages produced when NULs removed from metadata
This commit is contained in:
+3
-1
@@ -3,9 +3,10 @@
|
||||
.pylintrc
|
||||
.pytest_cache/
|
||||
.ruffus_history.sqlite
|
||||
.venv/
|
||||
.venv*/
|
||||
*.pyc
|
||||
*.sublime-*
|
||||
*.DS_Store
|
||||
|
||||
# Package building
|
||||
.eggs/
|
||||
@@ -42,3 +43,4 @@ tests/resources/private/
|
||||
tmp/
|
||||
/debug_tests.py
|
||||
*.traineddata
|
||||
/private
|
||||
|
||||
@@ -13,6 +13,11 @@ Note that it is licensed under GPLv3, so scripts that ``import ocrmypdf`` and ar
|
||||
find: [^`]\#([0-9]{1,3})[^0-9]
|
||||
replace: `#$1 <https://github.com/jbarlow83/OCRmyPDF/issues/$1>`_
|
||||
|
||||
v8.3.1
|
||||
------
|
||||
|
||||
- Fixed an issue where PDFs with malformed metadata would be rendered as blank pages. `#398 <https://github.com/jbarlow83/OCRmyPDF/issues/398>`_.
|
||||
|
||||
v8.3.0
|
||||
------
|
||||
|
||||
|
||||
@@ -816,15 +816,17 @@ def convert_to_pdfa(input_files_groups, output_file, log, context):
|
||||
# NULs in DocumentInfo seem to be common since older Acrobats included them.
|
||||
# pikepdf can deal with this, but we make the world a better place by
|
||||
# stamping them out as soon as possible.
|
||||
modified = False
|
||||
with pikepdf.open(layers_file) as pdf_layers_file:
|
||||
if pdf_layers_file.docinfo:
|
||||
modified = False
|
||||
for k, v in pdf_layers_file.docinfo.items():
|
||||
if b'\x00' in bytes(v):
|
||||
pdf_layers_file.docinfo[k] = bytes(v).replace(b'\x00', b'')
|
||||
modified = True
|
||||
if modified:
|
||||
pdf_layers_file.save(layers_file)
|
||||
if modified:
|
||||
pdf_layers_file.save(layers_file + '_')
|
||||
if modified:
|
||||
os.replace(layers_file + '_', layers_file)
|
||||
|
||||
ps = next((ii for ii in input_files if ii.endswith('.ps')), None)
|
||||
ghostscript.generate_pdfa(
|
||||
|
||||
Reference in New Issue
Block a user