From 40b650a98d40a3fe69d458cbea6cb97e8cba3226 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 2 Dec 2014 15:12:28 +0000 Subject: [PATCH] Added -keep-l --- Changes | 4 ++++ cpdfcommand.ml | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index fb430bf..6a32e5d 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +Version 2.2 + +o -keep-l keeps existing linearization status + Version 2.1 (November 2014) o Encryption now much, much faster diff --git a/cpdfcommand.ml b/cpdfcommand.ml index e878ded..4818a84 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1920,8 +1920,11 @@ let get_single_pdf_nodecrypt read_lazy = let really_write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf outname = if args.debugcrypt then Printf.printf "really_write_pdf\n%!"; + let will_linearize = + args.linearize || args.keeplinearize && pdf.Pdf.was_linearized + in let outname' = - if args.linearize then Filename.temp_file "cpdflin" ".pdf" else outname + if will_linearize then Filename.temp_file "cpdflin" ".pdf" else outname in if args.debugcrypt then Printf.printf "args.recrypt = %b, args.was_encrypted = %b\n" @@ -1962,7 +1965,7 @@ let really_write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf outna end end; begin - if args.linearize then + if will_linearize then let cpdflin = Cpdf.find_cpdflin args.cpdflin in match args.inputs with [] -> raise (Pdf.PDFError "no input in recryption")