diff --git a/cpdf.ml b/cpdf.ml index 36fd1bb..860c6ae 100644 --- a/cpdf.ml +++ b/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) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 6109285..5ad830b 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -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 diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 4dbc072..ad46ab9 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 80115e4..c3b8e6f 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -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}: