Fixed a page label bug

This commit is contained in:
John Whitington 2014-09-17 17:59:27 +01:00
parent da901666b9
commit 10e9e92217
1 changed files with 9 additions and 9 deletions

18
cpdf.ml
View File

@ -3256,8 +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 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 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
@ -3268,8 +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"; (*Printf.printf "Before adding, we have these labels:\n";
iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels; iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels;*)
iter iter
(function (s, e) -> (function (s, e) ->
let label = let label =
@ -3278,11 +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"; (*Printf.printf "We are adding this label:\n";
flprint (Pdfpagelabels.string_of_pagelabel label); flprint (Pdfpagelabels.string_of_pagelabel label);*)
labels := Pdfpagelabels.add_label !labels label e) labels := Pdfpagelabels.add_label (Pdfpage.endpage pdf) !labels label e)
ranges; ranges;
Printf.printf "After adding, we have these labels:\n"; (*Printf.printf "After adding, we have these labels:\n";
iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels; iter (fun x -> flprint (Pdfpagelabels.string_of_pagelabel x)) !labels;*)
Pdfpagelabels.write pdf !labels Pdfpagelabels.write pdf !labels