From 91b81da6796df762f691dc45e6d0ae3ea01988f9 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 18 Sep 2014 14:27:07 +0100 Subject: [PATCH] Page label fixes + documentation --- cpdf.ml | 18 +++++++++--------- cpdf.mli | 3 ++- cpdfcommand.ml | 9 +++++---- cpdfmanual.pdf | Bin 206108 -> 206146 bytes cpdfmanual.tex | 5 +++-- 5 files changed, 19 insertions(+), 16 deletions(-) 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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o%*XW~u)LvEv9Q zf4)$%PsC^rx$;FHa|VAoWohV3tX%$Rmz$xxZ;?tzNf0w)B@T zxGKnqqQ=t3`wE$n3XCrrEdAhbVkAR>-9?k7r>Dfoh=R8&wp)Mtkv_U04+=i8=(O~c zpNgrrG<0Bmfz!nhWsKrFp*@6ZoyHY5))Ns{dZzK1S(#8*E zV{sR`hioF0bMe5^pZ=^>tSw}%TBX`u*&siDTMg0>wZ$5 z)FWzMrOE&NNUQX`Dt$F$n#)S3|Miv@)X>z0IxKzmf*60tVaDW^^;-IOiyB*H|N(I&Fv$edaI zw_0T^%jgSPhRmC_{6h;1JWt=jVV<2ZYhTmCNn{yWH0yaqj3FyqLsraszu%ly9-z;n zLbHoz1Al+e!X@Mea>Z=0TZ~C7)7*5^Y@|!<7NU9RPWdg*i&45R^ES;U&xt)WTYZ-+ z--1-kGVQqQ;HFPIHhP`esU9uhrDL8qmh8u381D>Y-fXt`oEY|XUcF)c3gGx#WBj+9M^yQ;k09|GkrOp`zV6bj=^1adS?W4W-iBb=RkI>b!INd zb6-KQ)|t7SAOW4zx%_R^qTJ5DXVd=y=jd)`ml-7k9||})GzujpMNdWw DqpZ-* 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}