def optimize_pdf(input_file: Path, context: PdfContext, executor: Executor): output_file = context.get_path('optimize.pdf') save_settings = dict( linearize=should_linearize(input_file, context), **get_pdf_save_settings(context.options.output_type), ) optimize(input_file, output_file, context, save_settings, executor) return output_file
def optimize_pdf(input_file: Path, context: PdfContext): output_file = context.get_path('optimize.pdf') save_settings = dict( compress_streams=True, preserve_pdfa=True, object_stream_mode=pikepdf.ObjectStreamMode.generate, linearize=should_linearize(input_file, context), ) optimize(input_file, output_file, context, save_settings) return output_file