More page label work
This commit is contained in:
parent
76aadd87fb
commit
da901666b9
8
cpdf.ml
8
cpdf.ml
|
@ -3256,6 +3256,8 @@ let page1 labels =
|
||||||
let add_page_labels pdf style prefix startval range =
|
let add_page_labels pdf 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
|
||||||
|
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 =
|
let labels =
|
||||||
if not (page1 labels) then
|
if not (page1 labels) then
|
||||||
ref
|
ref
|
||||||
|
@ -3266,6 +3268,8 @@ let add_page_labels pdf style prefix startval range =
|
||||||
else
|
else
|
||||||
ref labels
|
ref labels
|
||||||
in
|
in
|
||||||
|
Printf.printf "Before adding, we have these labels:\n";
|
||||||
|
iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels;
|
||||||
iter
|
iter
|
||||||
(function (s, e) ->
|
(function (s, e) ->
|
||||||
let label =
|
let label =
|
||||||
|
@ -3274,7 +3278,11 @@ let add_page_labels pdf style prefix startval range =
|
||||||
Pdfpagelabels.startpage = s;
|
Pdfpagelabels.startpage = s;
|
||||||
Pdfpagelabels.startvalue = startval}
|
Pdfpagelabels.startvalue = startval}
|
||||||
in
|
in
|
||||||
|
Printf.printf "We are adding this label:\n";
|
||||||
|
flprint (Pdfpagelabels.string_of_pagelabel label);
|
||||||
labels := Pdfpagelabels.add_label !labels label e)
|
labels := Pdfpagelabels.add_label !labels label e)
|
||||||
ranges;
|
ranges;
|
||||||
|
Printf.printf "After adding, we have these labels:\n";
|
||||||
|
iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels;
|
||||||
Pdfpagelabels.write pdf !labels
|
Pdfpagelabels.write pdf !labels
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue