pipeline: remove fitz-based attempt to repair table of contents

Prior to unsplit, if we were rebuilding the PDF we'd lose the
table of contents. With unsplit we keep the original file and patch
the table of contents as necessary, adn that works fine.
This remaining bit of code from PyMuPDF actually damages the
table of contents and removing it fixes the test suite. G'bye.
This commit is contained in:
James R. Barlow
2018-05-16 23:24:57 -07:00
parent cdb737259c
commit 35cb416563
+10 -25
View File
@@ -770,7 +770,16 @@ def metadata_fixup(
)
if options.output_type.startswith('pdfa'):
_do_merge_ghostscript([layers_file, ps], output_file, log, context)
input_pdfinfo = context.get_pdfinfo()
ghostscript.generate_pdfa(
pdf_version=input_pdfinfo.min_version,
pdf_pages=[layers_file, ps],
output_file=output_file,
compression=options.pdfa_image_compression,
log=log,
threads=options.jobs or 1,
pdfa_part=options.output_type[-1] # is pdfa-1, pdfa-2, or pdfa-3
)
else:
metadata = pikepdf.open(metadata_file)
pdfmark = get_pdfmark(metadata, options)
@@ -779,30 +788,6 @@ def metadata_fixup(
pdf.save(output_file)
def _do_merge_ghostscript(
pdf_pages,
output_file,
log,
context):
options = context.get_options()
input_pdfinfo = context.get_pdfinfo()
ghostscript.generate_pdfa(
pdf_version=input_pdfinfo.min_version,
pdf_pages=pdf_pages,
output_file=output_file + '_toc.pdf',
compression=options.pdfa_image_compression,
log=log,
threads=options.jobs or 1,
pdfa_part=options.output_type[-1]) # is pdfa-1, pdfa-2, or pdfa-3
if fitz:
doc = fitz.Document(output_file + '_toc.pdf')
doc.setToC(input_pdfinfo.table_of_contents)
doc.save(output_file, clean=False)
else:
os.replace(output_file + '_toc.pdf', output_file)
def optimize_pdf(
input_file,
output_file,