Documentation for -squeeze

This commit is contained in:
John Whitington 2014-09-23 19:18:54 +01:00
parent 0f19595dd4
commit 274d580f98
3 changed files with 35 additions and 16 deletions

View File

@ -1826,22 +1826,30 @@ let squeeze_all_content_streams pdf =
Some d -> d
| None -> Pdf.Dictionary []
in
begin try
let newstream =
let content_streams =
match lookup "/Contents" dict with
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.parse_operators pdf resources [Pdf.Indirect i])
| Some (Pdf.Array x) ->
Pdfops.stream_of_ops
(Pdfops.parse_operators pdf resources x)
| _ ->
raise (Pdf.PDFError "squeeze_all_content_streams")
(Pdfops.parse_operators pdf resources content_streams)
in
let newdict =
Pdf.add_dict_entry
d "/Contents" (Pdf.Indirect (Pdf.addobj pdf newstream))
in
Pdf.addobj_given_num pdf (objnum, newdict)
with
(* No /Contents, which is ok. *)
Not_found -> ()
end
| _ -> ())
pdf

Binary file not shown.

View File

@ -943,11 +943,22 @@ PDF, use:
\section{Squeezing a Document}
\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}
\small\verb!cpdf -squeeze in.pdf -o out.pdf!
\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}
\begin{framed}