From 7c59c36fed4ecda9996881a26579e765b97a804c Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 29 Oct 2014 13:25:21 +0000 Subject: [PATCH] Allow -decompress to decompress object streams too --- cpdfcommand.ml | 11 ++++++----- cpdfmanual.pdf | Bin 207677 -> 207766 bytes cpdfmanual.tex | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 382418e..9d42eec 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1929,7 +1929,7 @@ let get_single_pdf_nodecrypt read_lazy = | _ -> raise (Arg.Bad "cpdf: No input specified.\n") -let really_write_pdf ?(encryption = None) mk_id pdf outname = +let really_write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf outname = if args.debugcrypt then Printf.printf "really_write_pdf\n%!"; let outname' = if args.linearize @@ -1953,6 +1953,7 @@ let really_write_pdf ?(encryption = None) mk_id pdf outname = Pdfwrite.pdf_to_file_options ~preserve_objstm:args.preserve_objstm ~generate_objstm:args.create_objstm + ~compress_objstm:(not is_decompress) false encryption mk_id pdf outname' end else @@ -2000,9 +2001,9 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf = if args.squeeze then Cpdf.squeeze pdf; Pdf.remove_unreferenced pdf end; - really_write_pdf mk_id pdf outname + really_write_pdf ~is_decompress mk_id pdf outname | Some _ -> - really_write_pdf ~encryption mk_id pdf outname + really_write_pdf ~encryption ~is_decompress mk_id pdf outname end | Stdout -> let temp = Filename.temp_file "cpdflin" ".pdf" in @@ -2015,9 +2016,9 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf = if args.squeeze then Cpdf.squeeze pdf; Pdf.remove_unreferenced pdf end; - really_write_pdf ~encryption mk_id pdf temp; + really_write_pdf ~encryption ~is_decompress mk_id pdf temp; | Some _ -> - really_write_pdf ~encryption mk_id pdf temp + really_write_pdf ~encryption ~is_decompress mk_id pdf temp end; let temp_file = open_in_bin temp in try diff --git a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0*#+y45XE4YD?gBxR8&lul$-mRmI~?r0F${Ui2wiq diff --git a/cpdfmanual.tex b/cpdfmanual.tex index b5c69f0..cbd5080 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -934,7 +934,7 @@ PDF, use: \begin{framed} \small\verb!cpdf -decompress in.pdf -o out.pdf! \end{framed} - \noindent If \cpdf\ finds a compression type it can't cope with, the stream is left compressed. + \noindent If \cpdf\ finds a compression type it can't cope with, the stream is left compressed. When using \texttt{-decompress}, object streams are not compressed. \section{Compressing a Document} \index{compressing} To compress the streams in a PDF file, use: