mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Fix -squeeze treatment of -no-pagedata and -no-recompress
This commit is contained in:
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
@ -1838,7 +1838,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 contents 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 contents 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 malformed compressed sections, and \texttt{-squeeze-no-pagedata} for avoiding the reprocessing of malformed page data.
|
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.
|
||||||
|
|
||||||
\begin{cpdflib}
|
\begin{cpdflib}
|
||||||
\clearpage
|
\clearpage
|
||||||
|
@ -36,7 +36,6 @@ let decompress_pdf pdf =
|
|||||||
(Pdf.iter_stream (Pdfcodec.decode_pdfstream_until_unknown pdf) pdf);
|
(Pdf.iter_stream (Pdfcodec.decode_pdfstream_until_unknown pdf) pdf);
|
||||||
pdf
|
pdf
|
||||||
|
|
||||||
|
|
||||||
(* Equality on PDF objects *)
|
(* Equality on PDF objects *)
|
||||||
let pdfobjeq pdf x y =
|
let pdfobjeq pdf x y =
|
||||||
let x = Pdf.lookup_obj pdf x
|
let x = Pdf.lookup_obj pdf x
|
||||||
@ -235,10 +234,16 @@ let squeeze ?logto ?(pagedata=true) ?(recompress=true) pdf =
|
|||||||
end;
|
end;
|
||||||
if recompress then
|
if recompress then
|
||||||
begin
|
begin
|
||||||
|
ignore (decompress_pdf pdf);
|
||||||
log (Printf.sprintf "Recompressing document\n");
|
log (Printf.sprintf "Recompressing document\n");
|
||||||
|
let n = !Pdfcodec.flate_level in
|
||||||
Pdfcodec.flate_level := 9;
|
Pdfcodec.flate_level := 9;
|
||||||
ignore (recompress_pdf pdf)
|
ignore (recompress_pdf pdf);
|
||||||
|
Pdfcodec.flate_level := n
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
(* Re-compress processed pagedata, even if recompress not set *)
|
||||||
|
if pagedata then ignore (recompress_pdf pdf)
|
||||||
with
|
with
|
||||||
e ->
|
e ->
|
||||||
raise
|
raise
|
||||||
|
Reference in New Issue
Block a user