Deprecate -squeeze-no-recompress

This commit is contained in:
John Whitington 2023-06-21 15:38:32 +01:00
parent 744aa0ffe5
commit 09d0e912ca
5 changed files with 8 additions and 12 deletions

View File

@ -3288,7 +3288,7 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf =
if not is_decompress then if not is_decompress then
begin begin
ignore (Cpdfsqueeze.recompress_pdf pdf); ignore (Cpdfsqueeze.recompress_pdf pdf);
if args.squeeze then Cpdfsqueeze.squeeze ~pagedata:args.squeeze_pagedata ~recompress:args.squeeze_recompress ?logto:!logto pdf; if args.squeeze then Cpdfsqueeze.squeeze ~pagedata:args.squeeze_pagedata ?logto:!logto pdf;
end; end;
Pdf.remove_unreferenced pdf; Pdf.remove_unreferenced pdf;
really_write_pdf ~is_decompress mk_id pdf outname really_write_pdf ~is_decompress mk_id pdf outname
@ -3303,7 +3303,7 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf =
if not is_decompress then if not is_decompress then
begin begin
ignore (Cpdfsqueeze.recompress_pdf pdf); ignore (Cpdfsqueeze.recompress_pdf pdf);
if args.squeeze then Cpdfsqueeze.squeeze ~pagedata:args.squeeze_pagedata ~recompress:args.squeeze_recompress ?logto:!logto pdf; if args.squeeze then Cpdfsqueeze.squeeze ~pagedata:args.squeeze_pagedata ?logto:!logto pdf;
Pdf.remove_unreferenced pdf Pdf.remove_unreferenced pdf
end; end;
really_write_pdf ~encryption ~is_decompress mk_id pdf temp; really_write_pdf ~encryption ~is_decompress mk_id pdf temp;
@ -3342,7 +3342,7 @@ let fast_write_split_pdfs
(stem original_filename) startpage endpage (stem original_filename) startpage endpage
in in
Pdf.remove_unreferenced pdf; Pdf.remove_unreferenced pdf;
if sq then Cpdfsqueeze.squeeze ~pagedata:args.squeeze_pagedata ~recompress:args.squeeze_recompress ?logto:!logto pdf; if sq then Cpdfsqueeze.squeeze ~pagedata:args.squeeze_pagedata ?logto:!logto pdf;
really_write_pdf ~encryption:enc (not (enc = None)) pdf name) really_write_pdf ~encryption:enc (not (enc = None)) pdf name)
(indx pagenums) (indx pagenums)
pagenums pagenums

Binary file not shown.

View File

@ -1869,7 +1869,7 @@ Final file size is 187200 bytes, 78.60% of original.
\noindent The \texttt{-squeeze-log-to <filename>} option writes the log to the given file instead of to standard output. Log content is appended to the end of the log file, preserving existing contents. \noindent The \texttt{-squeeze-log-to <filename>} option writes the log to the given file instead of to standard output. Log content is appended to the end of the log file, preserving existing contents.
There are two options which turn off parts of the squeezer. They are \texttt{-squeeze-no-recompress} for avoiding the reprocessing of compressed sections (especially useful if they are malformed), and \texttt{-squeeze-no-pagedata} for avoiding the reprocessing of page data (ditto). These two options also make the process much faster at the cost of a little less compression. Experiment. The option \texttt{-squeeze-no-pagedata} avoids the reprocessing of page data, which avoids problems in case of malformed files, and makes the process much faster at the cost of a little less compression. The option \texttt{-squeeze-no-recompress} is deprecated as of version 2.6 and has no effect.
\begin{cpdflib} \begin{cpdflib}
\clearpage \clearpage

View File

@ -210,7 +210,7 @@ let squeeze_all_content_streams pdf =
pdf pdf
(* We run squeeze enough times for the number of objects to not change *) (* We run squeeze enough times for the number of objects to not change *)
let squeeze ?logto ?(pagedata=true) ?(recompress=true) pdf = let squeeze ?logto ?(pagedata=true) pdf =
let log x = let log x =
match logto with match logto with
None -> print_string x; flush stdout None -> print_string x; flush stdout
@ -233,11 +233,8 @@ let squeeze ?logto ?(pagedata=true) ?(recompress=true) pdf =
log (Printf.sprintf "Squeezing page data and xobjects\n"); log (Printf.sprintf "Squeezing page data and xobjects\n");
squeeze_all_content_streams pdf; squeeze_all_content_streams pdf;
end; end;
if recompress then log (Printf.sprintf "Recompressing document\n");
begin ignore (recompress_pdf pdf);
log (Printf.sprintf "Recompressing document\n");
ignore (recompress_pdf pdf);
end
with with
e -> e ->
raise raise
@ -245,4 +242,3 @@ let squeeze ?logto ?(pagedata=true) ?(recompress=true) pdf =
(Printf.sprintf (Printf.sprintf
"Squeeze failed. No output written.\n Proximate error was:\n %s" "Squeeze failed. No output written.\n Proximate error was:\n %s"
(Printexc.to_string e))) (Printexc.to_string e)))

View File

@ -8,4 +8,4 @@ val recompress_pdf : Pdf.t -> Pdf.t
val decompress_pdf : Pdf.t -> Pdf.t val decompress_pdf : Pdf.t -> Pdf.t
(** Squeeze a PDF *) (** Squeeze a PDF *)
val squeeze : ?logto:string -> ?pagedata:bool -> ?recompress:bool -> Pdf.t -> unit val squeeze : ?logto:string -> ?pagedata:bool -> Pdf.t -> unit