Experimental qpdf merging
Does not copy /Catalog metadata, but otherwise functional
This commit is contained in:
+4
-2
@@ -1119,8 +1119,10 @@ def merge_pages(
|
||||
return key
|
||||
|
||||
pdf_pages = sorted(input_files, key=input_file_order)
|
||||
log.debug("Final pages: " + "\n".join(pdf_pages))
|
||||
ghostscript.generate_pdfa(pdf_pages, output_file, options.jobs or 1)
|
||||
#log.debug("Final pages: " + "\n".join(pdf_pages))
|
||||
#ghostscript.generate_pdfa(pdf_pages, output_file, options.jobs or 1)
|
||||
pdf_pages.pop()
|
||||
qpdf.merge(pdf_pages, output_file)
|
||||
|
||||
|
||||
@transform(
|
||||
|
||||
@@ -85,3 +85,15 @@ def split_pages(input_file, work_folder, npages):
|
||||
os.path.join(work_folder, '{0:06d}.page.pdf'.format(n + 1))
|
||||
]
|
||||
check_call(args_qpdf)
|
||||
|
||||
|
||||
def merge(input_files, output_file):
|
||||
"""Merge the list of input files (all filenames) into the output file.
|
||||
|
||||
The input files may contain one or more pages.
|
||||
"""
|
||||
args_qpdf = [
|
||||
get_program('qpdf'), input_files[0], '--pages'
|
||||
] + input_files + ['--', output_file]
|
||||
check_call(args_qpdf)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user