Fixed a page label bug
This commit is contained in:
parent
da901666b9
commit
10e9e92217
18
cpdf.ml
18
cpdf.ml
|
@ -3256,8 +3256,8 @@ 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
|
||||
|
@ -3268,8 +3268,8 @@ let add_page_labels pdf style prefix startval range =
|
|||
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);
|
||||
labels := Pdfpagelabels.add_label !labels label e)
|
||||
(*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
|
||||
|
||||
|
|
Loading…
Reference in New Issue