Added -qs-quiet

This commit is contained in:
John Whitington 2019-07-22 14:00:37 +01:00
parent db3598ff00
commit 0505d574d3
3 changed files with 33 additions and 7 deletions

View File

@ -423,6 +423,7 @@ type args =
mutable alsosetxml : bool;
mutable justsetxml : bool;
mutable gs_malformed : bool;
mutable gs_quiet : bool;
mutable merge_add_bookmarks : bool;
mutable merge_add_bookmarks_use_titles : bool;
mutable createpdf_pages : int;
@ -517,6 +518,7 @@ let args =
alsosetxml = false;
justsetxml = false;
gs_malformed = false;
gs_quiet = false;
merge_add_bookmarks = false;
merge_add_bookmarks_use_titles = false;
createpdf_pages = 1;
@ -608,7 +610,7 @@ let reset_arguments () =
args.removeonly <- None
(* Do not reset original_filename or cpdflin or was_encrypted or
* was_decrypted_with_owner or recrypt or producer or creator or
* path_to_ghostscript or gs_malformed, since we want these to work across
* path_to_ghostscript or gs_malformed or gs_quiet, since we want these to work across
* ANDs. Or squeeze: a little odd, but we want it to happen on eventual output. *)
let get_pagespec () =
@ -1672,6 +1674,9 @@ let setcreatepdfpapersize s =
let setdraftremoveonly s =
args.removeonly <- Some s
let setgsquiet () =
args.gs_quiet <- true
(* Parse a control file, make an argv, and then make Arg parse it. *)
let rec make_control_argv_and_parse filename =
control_args := !control_args @ parse_control_file filename
@ -2282,7 +2287,8 @@ and specs =
Arg.String setcreatepdfpapersize,
" Paper size for new PDF");
("-gs", Arg.String setgspath, " Path to gs executable");
("-gs-malformed", Arg.Unit setgsmalformed, " Try to reconstruct malformed files with gs");
("-gs-malformed", Arg.Unit setgsmalformed, " Also try to reconstruct malformed files with gs");
("-gs-quiet", Arg.Unit setgsquiet, " Make gs go into quiet mode");
("-squeeze", Arg.Unit setsqueeze, " Squeeze");
("-squeeze-log-to", Arg.String setsqueezelogto, " Squeeze log location");
(*These items are undocumented *)
@ -2336,7 +2342,7 @@ let embed_missing_fonts fi fo =
end;
let gscall =
args.path_to_ghostscript ^
" -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ fo ^
" -dNOPAUSE " ^ (if args.gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ fo ^
" -dBATCH " ^ fi
in
match Sys.command gscall with
@ -2355,7 +2361,7 @@ let mend_pdf_file_with_ghostscript filename =
tempfiles := tmpout::!tempfiles;
let gscall =
args.path_to_ghostscript ^
" -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ tmpout ^
" -dNOPAUSE " ^ (if args.gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ tmpout ^
" -dBATCH " ^ filename
in
match Sys.command gscall with
@ -4622,7 +4628,7 @@ let gs_malformed_force fi fo =
end;
let gscall =
args.path_to_ghostscript ^
" -dNOPAUSE -dQUIET -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ fo ^
" -dNOPAUSE " ^ (if args.gs_quiet then "-dQUIET" else "") ^ " -sDEVICE=pdfwrite -sOUTPUTFILE=" ^ fo ^
" -dBATCH " ^ fi
in
match Sys.command gscall with

Binary file not shown.

View File

@ -563,7 +563,9 @@ The standard paper sizes are listed in Section \ref{papersizes}, or you may spec
\small
\noindent\begin{verbatim}
cpdf -merge in1.pdf [<range>] in2.pdf [<range>] [<more names/ranges>]
[-retain-numbering] [-remove-duplicate-fonts] -o out.pdf\end{verbatim}
[-retain-numbering] [-remove-duplicate-fonts]
[-merge-add-bookmarks] [-merge-add-bookmarks-use-title]
-o out.pdf\end{verbatim}
\vspace{1.5mm}
\noindent\verb!cpdf -split in.pdf -o <format> [-chunk <chunksize>]!
@ -597,9 +599,11 @@ the document which first exhibits that feature.
The \texttt{-retain-numbering} option keeps the PDF page numbering labels of
each document intact, rather than renumbering the output pages from 1.
The \texttt{-remove-duplicate-fonts} ensures that fonts used in more than one
The \texttt{-remove-duplicate-fonts} option ensures that fonts used in more than one
of the inputs only appear once in the output.
The \texttt{-merge-add-bookmarks} option adds a top-level bookmark for each file, using the filename. Any existing bookmarks are retained. Adding \texttt{-merge-add-bookmarks-use-titles} will use the title from each PDF's metadata instead of the filename.
\section{Splitting}
\index{splitting}
The \texttt{-split} operation splits a PDF file into a number of parts which
@ -1128,6 +1132,10 @@ The \texttt{-squeeze-log-to <filename>} option writes the log to the given file
\vspace{1.5mm}
\small\noindent\verb!cpdf -add-bookmarks <bookmark file> in.pdf -o out.pdf!
\vspace{1.5mm}
\small\noindent\verb!cpdf -bookmarks-open-to-level <n> in.pdf -o out.pdf!
\end{framed}
\index{bookmarks}
\index{document outline}
@ -1188,6 +1196,18 @@ will be given if the bookmarks file is not in the correct form (in particular,
the numbers in the first column which specify the level must form a proper
tree with no entry being more than one greater than the last).
\section{Opening bookmarks}
As an alternative to extracting a bookmark file and manipulating the open-status of bookmarks, mass manipulation may be achieved by the following option.
\begin{framed}
\small\verb!cpdf -open-bookmarks-to-level <level> in.pdf -o out.pdf!
\end{framed}
A level of 0 will close all bookmarks, level 1 will open just the top level, closing all others etc. To open all of them, pick a sufficiently large level.
\chapter{Presentations}
\begin{framed}
\small\noindent\begin{verbatim}