Fix -range for -stdin and tidy up
This commit is contained in:
parent
df0c6c4c45
commit
b13f1f592f
6
cpdf.ml
6
cpdf.ml
|
@ -108,7 +108,6 @@ let squeeze_form_xobject pdf objnum =
|
|||
let obj = Pdf.lookup_obj pdf objnum in
|
||||
match Pdf.lookup_direct pdf "/Subtype" obj with
|
||||
Some (Pdf.Name "/Form") ->
|
||||
Printf.printf "squeeze_form_xobject at object %i\n%!" objnum;
|
||||
let resources =
|
||||
match Pdf.lookup_direct pdf "/Resources" obj with
|
||||
Some d -> d
|
||||
|
@ -166,7 +165,8 @@ let squeeze_all_content_streams pdf =
|
|||
d "/Contents" (Pdf.Indirect (Pdf.addobj pdf newstream))
|
||||
in
|
||||
Pdf.addobj_given_num pdf (objnum, newdict);
|
||||
(* Now process all xobjects related to this page *)
|
||||
(* Now process all xobjects related to this page
|
||||
FIXME due to their shared nature, we are overdoing this work! *)
|
||||
begin match Pdf.lookup_direct pdf "/XObject" resources with
|
||||
Some (Pdf.Dictionary xobjs) ->
|
||||
iter
|
||||
|
@ -195,7 +195,7 @@ let squeeze pdf =
|
|||
n := Pdf.objcard pdf;
|
||||
Printf.printf "Squeezing... Down to %i objects\n%!" (Pdf.objcard pdf);
|
||||
done;
|
||||
Printf.printf "Squeezing page data\n%!";
|
||||
Printf.printf "Squeezing page data and xobjects\n%!";
|
||||
squeeze_all_content_streams pdf;
|
||||
Printf.printf "Recompressing document\n%!";
|
||||
ignore (recompress_pdf pdf)
|
||||
|
|
|
@ -1084,7 +1084,11 @@ let setextractimages () =
|
|||
|
||||
(* Explicitly add a range. Parse it and replace the top input file with the range. *)
|
||||
let setrange spec =
|
||||
args.dashrange <- spec
|
||||
args.dashrange <- spec;
|
||||
match args.inputs with
|
||||
(StdIn, a, b, c, d)::more ->
|
||||
args.inputs <- (StdIn, spec, b, c, d) :: more
|
||||
| x -> ()
|
||||
|
||||
let setoutline () =
|
||||
args.outline <- true
|
||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -324,6 +324,15 @@ option to the command line, in addition to any other command being used. For exa
|
|||
\noindent Linearize the file \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
||||
\end{framed}
|
||||
|
||||
\noindent This requires the existence of the external program \texttt{cpdflin} which is provided with \texttt{cpdf}. For Unix and Mac OS X, and for Windows under Cygwin or Mingw, it suffices to place the \texttt{cpdflin} executable in the same folder as \texttt{cpdf}. On Windows with \texttt{command.exe}, you must use \texttt{-cpdflin} to let \texttt{cpdf} know where to find it:
|
||||
|
||||
\begin{framed}
|
||||
\small\verb!cpdf.exe -cpdflin "C:\\cpdflin.exe" -l in.pdf -o out.pdf!
|
||||
|
||||
\vspace{2.5mm}
|
||||
\noindent Linearize the file \texttt{in.pdf}, writing to \texttt{out.pdf}.
|
||||
\end{framed}
|
||||
|
||||
\section{Object Streams}
|
||||
PDF 1.5 introduced a new mechanism for storing objects to save space: object streams. by default, \texttt{cpdf} will preserve object streams in input files, creating no more. To prevent the retention of existing object streams, use \texttt{-no-preserve-objstm}:
|
||||
|
||||
|
|
Loading…
Reference in New Issue