mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-02-16 11:50:54 +01:00
Fix -squeeze treatment of -no-pagedata and -no-recompress
This commit is contained in:
parent
214e3c3fa2
commit
496d10dea2
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.
|
||||
|
||||
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}
|
||||
\clearpage
|
||||
|
@ -36,7 +36,6 @@ let decompress_pdf pdf =
|
||||
(Pdf.iter_stream (Pdfcodec.decode_pdfstream_until_unknown pdf) pdf);
|
||||
pdf
|
||||
|
||||
|
||||
(* Equality on PDF objects *)
|
||||
let pdfobjeq pdf x y =
|
||||
let x = Pdf.lookup_obj pdf x
|
||||
@ -235,10 +234,16 @@ let squeeze ?logto ?(pagedata=true) ?(recompress=true) pdf =
|
||||
end;
|
||||
if recompress then
|
||||
begin
|
||||
ignore (decompress_pdf pdf);
|
||||
log (Printf.sprintf "Recompressing document\n");
|
||||
let n = !Pdfcodec.flate_level in
|
||||
Pdfcodec.flate_level := 9;
|
||||
ignore (recompress_pdf pdf)
|
||||
ignore (recompress_pdf pdf);
|
||||
Pdfcodec.flate_level := n
|
||||
end
|
||||
else
|
||||
(* Re-compress processed pagedata, even if recompress not set *)
|
||||
if pagedata then ignore (recompress_pdf pdf)
|
||||
with
|
||||
e ->
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user