diff --git a/cpdf.ml b/cpdf.ml index 783b230..48b0961 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -3256,20 +3256,20 @@ let page1 labels = let add_page_labels pdf style prefix startval range = let ranges = map extremes (ranges_of_range [] [] range) and labels = Pdfpagelabels.read pdf in - (*Printf.printf "We have %i existing labels\n" (List.length labels); - Printf.printf "We have %i ranges to apply these labels to\n" (List.length ranges);*) + Printf.printf "We have %i existing labels\n" (List.length labels); + Printf.printf "We have %i ranges to apply these labels to\n" (List.length ranges); let labels = if not (page1 labels) then ref - ({Pdfpagelabels.labelstyle = Some Pdfpagelabels.DecimalArabic; + ({Pdfpagelabels.labelstyle = Pdfpagelabels.DecimalArabic; Pdfpagelabels.labelprefix = None; Pdfpagelabels.startpage = 1; Pdfpagelabels.startvalue = 1}::labels) else ref labels in - (*Printf.printf "Before adding, we have these labels:\n"; - iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels;*) + Printf.printf "Before adding, we have these labels:\n"; + iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels; iter (function (s, e) -> let label = @@ -3278,11 +3278,11 @@ let add_page_labels pdf style prefix startval range = Pdfpagelabels.startpage = s; Pdfpagelabels.startvalue = startval} in - (*Printf.printf "We are adding this label:\n"; - flprint (Pdfpagelabels.string_of_pagelabel label);*) + Printf.printf "We are adding this label:\n"; + flprint (Pdfpagelabels.string_of_pagelabel label); labels := Pdfpagelabels.add_label (Pdfpage.endpage pdf) !labels label e) ranges; - (*Printf.printf "After adding, we have these labels:\n"; - iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels;*) + Printf.printf "After adding, we have these labels:\n"; + iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels; Pdfpagelabels.write pdf !labels diff --git a/cpdf.mli b/cpdf.mli index 37efdf4..a6f8f4b 100644 --- a/cpdf.mli +++ b/cpdf.mli @@ -399,7 +399,8 @@ val blank_document_paper : Pdfpaper.t -> int -> Pdf.t (** {2 Page labels} *) (** Add page labels. *) -val add_page_labels : Pdf.t -> Pdfpagelabels.labelstyle option -> string option -> int -> int list -> unit +val add_page_labels : + Pdf.t -> Pdfpagelabels.labelstyle -> string option -> int -> int list -> unit (** {2 Miscellany} *) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index c642a9c..ad05bcb 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -255,7 +255,7 @@ type args = mutable makenewid : bool; mutable ismulti : bool; mutable uprightstamp : bool; - mutable labelstyle : Pdfpagelabels.labelstyle option; + mutable labelstyle : Pdfpagelabels.labelstyle; mutable labelprefix : string option; mutable labeloffset : int option; mutable squeeze : bool} @@ -338,7 +338,7 @@ let args = makenewid = false; ismulti = false; uprightstamp = false; - labelstyle = None; + labelstyle = Pdfpagelabels.DecimalArabic; labelprefix = None; labeloffset = None; squeeze = false} @@ -412,7 +412,7 @@ let reset_arguments () = args.makenewid <- false; args.ismulti <- false; args.uprightstamp <- false; - args.labelstyle <- None; + args.labelstyle <- Pdfpagelabels.DecimalArabic; args.labelprefix <- None; args.labeloffset <- None; args.squeeze <- false @@ -1213,9 +1213,10 @@ let setlabelstyle s = | "LowercaseRoman" -> Pdfpagelabels.LowercaseRoman | "UppercaseLetters" -> Pdfpagelabels.UppercaseLetters | "LowercaseLetters" -> Pdfpagelabels.LowercaseLetters + | "NoLabelPrefixOnly" -> Pdfpagelabels.NoLabelPrefixOnly | _ -> error "Unknown label style" in - args.labelstyle <- Some style + args.labelstyle <- style let setlabelprefix s = args.labelprefix <- Some s diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 6b4bdd1..682ee0e 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 1dd560e..0e44e5b 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -1780,8 +1780,9 @@ It is possible to add \textit{page labels} to a document. These are not the prin \texttt{DecimalArabic} & 1,2,3,4,5\ldots \\ \texttt{LowercaseRoman} & i,ii,iii,iv,v\ldots \\ \texttt{UppercaseRoman} & I,II,III,IV,V\ldots \\ - \texttt{LowercaseLetters} & a,b,c,\ldots,z,aa,ab\ldots \\ - \texttt{UppercaseLetters} & A,B,C,\ldots,Z,AA,AB\ldots \\ + \texttt{LowercaseLetters} & a,b,c,\ldots,z,aa,bb\ldots \\ + \texttt{UppercaseLetters} & A,B,C,\ldots,Z,AA,BB\ldots \\ + \texttt{NoLabelPrefixOnly} & No number, but a prefix will be used if defined. \end{tabular} \vspace{4mm}