Documentation for -squeeze
This commit is contained in:
parent
0f19595dd4
commit
274d580f98
|
@ -1826,22 +1826,30 @@ let squeeze_all_content_streams pdf =
|
||||||
Some d -> d
|
Some d -> d
|
||||||
| None -> Pdf.Dictionary []
|
| None -> Pdf.Dictionary []
|
||||||
in
|
in
|
||||||
|
begin try
|
||||||
let newstream =
|
let newstream =
|
||||||
|
let content_streams =
|
||||||
match lookup "/Contents" dict with
|
match lookup "/Contents" dict with
|
||||||
Some (Pdf.Indirect i) ->
|
Some (Pdf.Indirect i) ->
|
||||||
|
begin match Pdf.direct pdf (Pdf.Indirect i) with
|
||||||
|
Pdf.Array x -> x
|
||||||
|
| _ -> [Pdf.Indirect i]
|
||||||
|
end
|
||||||
|
| Some (Pdf.Array x) -> x
|
||||||
|
| _ -> raise Not_found
|
||||||
|
in
|
||||||
Pdfops.stream_of_ops
|
Pdfops.stream_of_ops
|
||||||
(Pdfops.parse_operators pdf resources [Pdf.Indirect i])
|
(Pdfops.parse_operators pdf resources content_streams)
|
||||||
| Some (Pdf.Array x) ->
|
|
||||||
Pdfops.stream_of_ops
|
|
||||||
(Pdfops.parse_operators pdf resources x)
|
|
||||||
| _ ->
|
|
||||||
raise (Pdf.PDFError "squeeze_all_content_streams")
|
|
||||||
in
|
in
|
||||||
let newdict =
|
let newdict =
|
||||||
Pdf.add_dict_entry
|
Pdf.add_dict_entry
|
||||||
d "/Contents" (Pdf.Indirect (Pdf.addobj pdf newstream))
|
d "/Contents" (Pdf.Indirect (Pdf.addobj pdf newstream))
|
||||||
in
|
in
|
||||||
Pdf.addobj_given_num pdf (objnum, newdict)
|
Pdf.addobj_given_num pdf (objnum, newdict)
|
||||||
|
with
|
||||||
|
(* No /Contents, which is ok. *)
|
||||||
|
Not_found -> ()
|
||||||
|
end
|
||||||
| _ -> ())
|
| _ -> ())
|
||||||
pdf
|
pdf
|
||||||
|
|
||||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -943,11 +943,22 @@ PDF, use:
|
||||||
|
|
||||||
\section{Squeezing a Document}
|
\section{Squeezing a Document}
|
||||||
\index{squeeze}
|
\index{squeeze}
|
||||||
To \textit{squeeze} a PDF file, use:
|
To \textit{squeeze} a PDF file, reducing its size by an average of about twenty percent (though sometimes not at all), use:
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\small\verb!cpdf -squeeze in.pdf -o out.pdf!
|
\small\verb!cpdf -squeeze in.pdf -o out.pdf!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
\noindent Adding \texttt{-squeeze} to the command line will \textit{squeeze} the file upon output. The squeezing process involves several processes which losslessly attempt to reduce the file size. The squeezing process is slow.
|
\noindent Adding \texttt{-squeeze} to the command line when using another operation will \textit{squeeze} the file or files upon output.
|
||||||
|
|
||||||
|
The \texttt{-squeeze} operation writes some information about the squeezing process to standard output. The squeezing process involves several processes which losslessly attempt to reduce the file size. It is slow, so should not be used without thought.
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
$ ./cpdf -squeeze in.pdf -o out.pdf
|
||||||
|
Beginning squeeze: 123847 objects
|
||||||
|
Squeezing... Down to 114860 objects
|
||||||
|
Squeezing... Down to 114842 objects
|
||||||
|
Squeezing page data
|
||||||
|
Recompressing document
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
\chapter{Bookmarks}
|
\chapter{Bookmarks}
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
|
|
Loading…
Reference in New Issue