Change command structure for -output-image
This commit is contained in:
parent
c8c8ddcae9
commit
7c0b52a0fa
|
@ -231,7 +231,7 @@ type op =
|
||||||
| SetLanguage of string
|
| SetLanguage of string
|
||||||
| Redact
|
| Redact
|
||||||
| Rasterize
|
| Rasterize
|
||||||
| OutputImage of string
|
| OutputImage
|
||||||
|
|
||||||
let string_of_op = function
|
let string_of_op = function
|
||||||
| PrintFontEncoding _ -> "PrintFontEncoding"
|
| PrintFontEncoding _ -> "PrintFontEncoding"
|
||||||
|
@ -386,7 +386,7 @@ let string_of_op = function
|
||||||
| SetLanguage _ -> "SetLanguage"
|
| SetLanguage _ -> "SetLanguage"
|
||||||
| Redact -> "Redact"
|
| Redact -> "Redact"
|
||||||
| Rasterize -> "Rasterize"
|
| Rasterize -> "Rasterize"
|
||||||
| OutputImage _ -> "OutputImage"
|
| OutputImage -> "OutputImage"
|
||||||
|
|
||||||
(* Inputs: filename, pagespec. *)
|
(* Inputs: filename, pagespec. *)
|
||||||
type input_kind =
|
type input_kind =
|
||||||
|
@ -948,7 +948,7 @@ let banned banlist = function
|
||||||
| OCGRename | OCGList | OCGOrderAll | PrintFontEncoding _ | TableOfContents | Typeset _ | Composition _
|
| OCGRename | OCGList | OCGOrderAll | PrintFontEncoding _ | TableOfContents | Typeset _ | Composition _
|
||||||
| TextWidth _ | SetAnnotations _ | CopyAnnotations _ | ExtractStream _ | PrintObj _ | ReplaceObj _
|
| TextWidth _ | SetAnnotations _ | CopyAnnotations _ | ExtractStream _ | PrintObj _ | ReplaceObj _
|
||||||
| Verify _ | MarkAs _ | RemoveMark _ | ExtractStructTree | ReplaceStructTree _ | SetLanguage _
|
| Verify _ | MarkAs _ | RemoveMark _ | ExtractStructTree | ReplaceStructTree _ | SetLanguage _
|
||||||
| PrintStructTree | Rasterize | OutputImage _
|
| PrintStructTree | Rasterize | OutputImage
|
||||||
-> false (* Always allowed *)
|
-> false (* Always allowed *)
|
||||||
(* Combine pages is not allowed because we would not know where to get the
|
(* Combine pages is not allowed because we would not know where to get the
|
||||||
-recrypt from -- the first or second file? *)
|
-recrypt from -- the first or second file? *)
|
||||||
|
@ -3022,7 +3022,7 @@ let specs =
|
||||||
("-rasterize-no-antialias", Arg.Unit (fun () -> args.rast_antialias <- false), " Don't antialias when rasterizing");
|
("-rasterize-no-antialias", Arg.Unit (fun () -> args.rast_antialias <- false), " Don't antialias when rasterizing");
|
||||||
("-rasterize-downsample", Arg.Unit (fun () -> args.rast_downsample <- true), " Antialias by downsampling");
|
("-rasterize-downsample", Arg.Unit (fun () -> args.rast_downsample <- true), " Antialias by downsampling");
|
||||||
("-rasterize-jpeg-quality", Arg.Int (fun i -> args.rast_jpeg_quality <- i), " Set JPEG quality");
|
("-rasterize-jpeg-quality", Arg.Int (fun i -> args.rast_jpeg_quality <- i), " Set JPEG quality");
|
||||||
("-output-image", Arg.String (fun s -> args.op <- Some (OutputImage s)), " Output pages as PNGs");
|
("-output-image", Arg.Unit (fun () -> args.op <- Some OutputImage), " Output pages as images");
|
||||||
(* These items are undocumented *)
|
(* These items are undocumented *)
|
||||||
("-debug", Arg.Unit setdebug, "");
|
("-debug", Arg.Unit setdebug, "");
|
||||||
("-debug-crypt", Arg.Unit (fun () -> args.debugcrypt <- true), "");
|
("-debug-crypt", Arg.Unit (fun () -> args.debugcrypt <- true), "");
|
||||||
|
@ -4894,7 +4894,8 @@ let go () =
|
||||||
let pdf = get_single_pdf args.op false in
|
let pdf = get_single_pdf args.op false in
|
||||||
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in
|
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in
|
||||||
write_pdf false (rasterize args.rast_antialias args.rast_downsample args.rast_device args.rast_res args.rast_annots args.rast_jpeg_quality pdf range)
|
write_pdf false (rasterize args.rast_antialias args.rast_downsample args.rast_device args.rast_res args.rast_annots args.rast_jpeg_quality pdf range)
|
||||||
| Some (OutputImage spec) ->
|
| Some OutputImage ->
|
||||||
|
let spec = match args.out with File spec -> spec | _ -> error "Output must be to a file" in
|
||||||
let pdf = get_single_pdf args.op false in
|
let pdf = get_single_pdf args.op false in
|
||||||
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in
|
let range = parse_pagespec_allow_empty pdf (get_pagespec ()) in
|
||||||
write_images args.rast_device args.rast_res args.rast_jpeg_quality args.tobox args.rast_annots args.rast_antialias args.rast_downsample spec pdf range
|
write_images args.rast_device args.rast_res args.rast_jpeg_quality args.tobox args.rast_annots args.rast_antialias args.rast_downsample spec pdf range
|
||||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -3837,7 +3837,7 @@ The \texttt{-dump-attachments} operation, when given a PDF file and a directory
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
|
|
||||||
\noindent\small\verb!cpdf -output-image <format> in.pdf <range>!\\
|
\noindent\small\verb!cpdf -output-image in.pdf <range> -o <format>!\\
|
||||||
\noindent\small\verb! [-rasterize[-gray|-1bpp|-jpeg|-jpeggray]!\\
|
\noindent\small\verb! [-rasterize[-gray|-1bpp|-jpeg|-jpeggray]!\\
|
||||||
\noindent\small\verb! [-rasterize-res <n>] [-rasterize-jpeg-quality <n>]!\\
|
\noindent\small\verb! [-rasterize-res <n>] [-rasterize-jpeg-quality <n>]!\\
|
||||||
\noindent\small\verb! [-rasterize-no-antialias | -rasterize-downsample]!
|
\noindent\small\verb! [-rasterize-no-antialias | -rasterize-downsample]!
|
||||||
|
@ -4085,7 +4085,7 @@ Option & Effect\\\hline
|
||||||
\noindent In addition to rasterization of pages, we can export them in PNG or JPEG format, again by the use of GhostScript:
|
\noindent In addition to rasterization of pages, we can export them in PNG or JPEG format, again by the use of GhostScript:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\noindent\small\verb!cpdf -gs gs -output-image image%%%.png in.pdf 10-end!
|
\noindent\small\verb!cpdf -gs gs -output-image in.pdf 10-end -o image%%%.png!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
\noindent This will extract pages 10 onwards to the files \texttt{image000.png}, \texttt{image001.png} and so on. All the options above apply, and in addition we can choose which box is rasterized:
|
\noindent This will extract pages 10 onwards to the files \texttt{image000.png}, \texttt{image001.png} and so on. All the options above apply, and in addition we can choose which box is rasterized:
|
||||||
|
@ -4100,8 +4100,8 @@ Option & Effect\\\hline
|
||||||
\noindent For example:
|
\noindent For example:
|
||||||
|
|
||||||
\begin{framed}
|
\begin{framed}
|
||||||
\noindent\small\verb!cpdf -gs gs -output-image image%%%.jpeg -tobox /BleedBox!\\
|
\noindent\small\verb!cpdf -gs gs -output-image -tobox /BleedBox!\\
|
||||||
\noindent\small\verb! -rasterization-jpeg in.pdf!
|
\noindent\small\verb! -rasterization-jpeg in.pdf -o image%%%.jpeg!
|
||||||
\end{framed}
|
\end{framed}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue