Implementation and documentation for -labels-progress
This commit is contained in:
parent
08ca9bea6f
commit
232312faef
1
Changes
1
Changes
|
@ -1,6 +1,7 @@
|
||||||
Version 2.4 (to come)
|
Version 2.4 (to come)
|
||||||
|
|
||||||
o Vendored in tiny_json from Yoshihiro Imai via Jan Furuse
|
o Vendored in tiny_json from Yoshihiro Imai via Jan Furuse
|
||||||
|
o New -labels-progress option to improve page labels interface
|
||||||
|
|
||||||
Version 2.3 (patchlevel 1, December 2019)
|
Version 2.3 (patchlevel 1, December 2019)
|
||||||
|
|
||||||
|
|
13
cpdf.ml
13
cpdf.ml
|
@ -4174,6 +4174,10 @@ let page1 labels =
|
||||||
let add_page_labels pdf progress style prefix startval range =
|
let add_page_labels pdf progress style prefix startval range =
|
||||||
let ranges = map extremes (ranges_of_range [] [] range)
|
let ranges = map extremes (ranges_of_range [] [] range)
|
||||||
and labels = Pdfpagelabels.read pdf in
|
and labels = Pdfpagelabels.read pdf in
|
||||||
|
assert (length ranges > 0);
|
||||||
|
let startval_additions =
|
||||||
|
0 :: map (fun x -> x - fst (List.hd ranges) - 1) (List.tl (List.map fst ranges))
|
||||||
|
in
|
||||||
let labels =
|
let labels =
|
||||||
if not (page1 labels) then
|
if not (page1 labels) then
|
||||||
ref
|
ref
|
||||||
|
@ -4184,16 +4188,17 @@ let add_page_labels pdf progress style prefix startval range =
|
||||||
else
|
else
|
||||||
ref labels
|
ref labels
|
||||||
in
|
in
|
||||||
iter
|
iter2
|
||||||
(function (s, e) ->
|
(fun (s, e) addition ->
|
||||||
let label =
|
let label =
|
||||||
{Pdfpagelabels.labelstyle = style;
|
{Pdfpagelabels.labelstyle = style;
|
||||||
Pdfpagelabels.labelprefix = prefix;
|
Pdfpagelabels.labelprefix = prefix;
|
||||||
Pdfpagelabels.startpage = s;
|
Pdfpagelabels.startpage = s;
|
||||||
Pdfpagelabels.startvalue = startval}
|
Pdfpagelabels.startvalue = startval + addition}
|
||||||
in
|
in
|
||||||
labels := Pdfpagelabels.add_label (Pdfpage.endpage pdf) !labels label e)
|
labels := Pdfpagelabels.add_label (Pdfpage.endpage pdf) !labels label e)
|
||||||
ranges;
|
ranges
|
||||||
|
startval_additions;
|
||||||
Pdfpagelabels.write pdf !labels
|
Pdfpagelabels.write pdf !labels
|
||||||
|
|
||||||
(* Parse the new content to make sure syntactically ok, append
|
(* Parse the new content to make sure syntactically ok, append
|
||||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -34,7 +34,7 @@ Command Line Toolkit}
|
||||||
\vspace{12mm}
|
\vspace{12mm}
|
||||||
|
|
||||||
{\Huge User Manual}\\
|
{\Huge User Manual}\\
|
||||||
Version 2.3 (October 2019)
|
Version 2.4 (? 2020)
|
||||||
|
|
||||||
\vspace{25mm}
|
\vspace{25mm}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ Version 2.3 (October 2019)
|
||||||
\noindent For bug reports, feature requests and comments, email\\ \texttt{contact@coherentgraphics.co.uk}
|
\noindent For bug reports, feature requests and comments, email\\ \texttt{contact@coherentgraphics.co.uk}
|
||||||
|
|
||||||
\vspace*{\fill}
|
\vspace*{\fill}
|
||||||
\noindent\copyright 2019 Coherent Graphics Limited. All rights reserved. ISBN 978-0957671140
|
\noindent\copyright 2020 Coherent Graphics Limited. All rights reserved. ISBN 978-0957671140
|
||||||
|
|
||||||
\smallgap
|
\smallgap
|
||||||
\noindent Adobe, Acrobat, Adobe PDF, Adobe Reader and PostScript are
|
\noindent Adobe, Acrobat, Adobe PDF, Adobe Reader and PostScript are
|
||||||
|
@ -1828,7 +1828,7 @@ given page range.
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\small\noindent\verb!cpdf -add-page-labels in.pdf -o out.pdf!\\
|
\small\noindent\verb!cpdf -add-page-labels in.pdf -o out.pdf!\\
|
||||||
\noindent\verb! [-label-style <style>] [-label-prefix <string>]!\\
|
\noindent\verb! [-label-style <style>] [-label-prefix <string>]!\\
|
||||||
\noindent\verb! [-label-startval <integer>]!\\
|
\noindent\verb! [-label-startval <integer>] [-labels-progress]!\\
|
||||||
|
|
||||||
\vspace{1.5mm}
|
\vspace{1.5mm}
|
||||||
\small\noindent\verb!cpdf -remove-page-labels in.pdf -o out.pdf!\\
|
\small\noindent\verb!cpdf -remove-page-labels in.pdf -o out.pdf!\\
|
||||||
|
@ -2105,7 +2105,7 @@ i, ii, iii, iv, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, A-0, A-1, A-2, A-3, A-4, A-5
|
||||||
\noindent\verb! -label-startval 0 -o out.pdf!
|
\noindent\verb! -label-startval 0 -o out.pdf!
|
||||||
\end{framed}}
|
\end{framed}}
|
||||||
|
|
||||||
\noindent By default the labels begin at page number 1 for each range. To override this, we can use \texttt{-label-startval} (we used $0$ in the final command), where we want the numbers to begin at zero rather than one.
|
\noindent By default the labels begin at page number 1 for each range. To override this, we can use \texttt{-label-startval} (we used $0$ in the final command), where we want the numbers to begin at zero rather than one. The option \texttt{-labels-progress} can be added to make sure the start value progresses between sub-ranges when the page range specified is disjoint, e.g \texttt{1-9, 30-40} or \texttt{odd}.
|
||||||
|
|
||||||
Page labels may be removed altogether by using \texttt{-remove-page-labels} command. To print the page labels from an existing file, use \texttt{-print-page-labels}. For example:
|
Page labels may be removed altogether by using \texttt{-remove-page-labels} command. To print the page labels from an existing file, use \texttt{-print-page-labels}. For example:
|
||||||
\begin{framed}\small\begin{verbatim}$ cpdf -print-page-labels cpdfmanual.pdf
|
\begin{framed}\small\begin{verbatim}$ cpdf -print-page-labels cpdfmanual.pdf
|
||||||
|
|
Loading…
Reference in New Issue