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
begin
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;
Pdf.remove_unreferenced pdf;
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
begin
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
end;
really_write_pdf ~encryption ~is_decompress mk_id pdf temp;
@ -3342,7 +3342,7 @@ let fast_write_split_pdfs
(stem original_filename) startpage endpage
in
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)
(indx 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.
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}
\clearpage

View File

@ -210,7 +210,7 @@ let squeeze_all_content_streams pdf =
pdf
(* 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 =
match logto with
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");
squeeze_all_content_streams pdf;
end;
if recompress then
begin
log (Printf.sprintf "Recompressing document\n");
ignore (recompress_pdf pdf);
end
log (Printf.sprintf "Recompressing document\n");
ignore (recompress_pdf pdf);
with
e ->
raise
@ -245,4 +242,3 @@ let squeeze ?logto ?(pagedata=true) ?(recompress=true) pdf =
(Printf.sprintf
"Squeeze failed. No output written.\n Proximate error was:\n %s"
(Printexc.to_string e)))

View File

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