Fixed -labels-progress
This commit is contained in:
parent
b54e4c84c3
commit
ca49e9d25e
7
cpdf.ml
7
cpdf.ml
|
@ -4177,7 +4177,10 @@ let add_page_labels pdf progress style prefix startval range =
|
||||||
and labels = Pdfpagelabels.read pdf in
|
and labels = Pdfpagelabels.read pdf in
|
||||||
assert (length ranges > 0);
|
assert (length ranges > 0);
|
||||||
let startval_additions =
|
let startval_additions =
|
||||||
0 :: map (fun x -> x - fst (List.hd ranges) - 1) (List.tl (List.map fst ranges))
|
let r = ref [] in
|
||||||
|
let sofar = ref 0 in
|
||||||
|
iter (fun (s, e) -> r := !sofar :: !r; sofar := e - s + 1 + !sofar) ranges;
|
||||||
|
rev !r
|
||||||
in
|
in
|
||||||
let labels =
|
let labels =
|
||||||
if not (page1 labels) then
|
if not (page1 labels) then
|
||||||
|
@ -4195,7 +4198,7 @@ let add_page_labels pdf progress style prefix startval range =
|
||||||
{Pdfpagelabels.labelstyle = style;
|
{Pdfpagelabels.labelstyle = style;
|
||||||
Pdfpagelabels.labelprefix = prefix;
|
Pdfpagelabels.labelprefix = prefix;
|
||||||
Pdfpagelabels.startpage = s;
|
Pdfpagelabels.startpage = s;
|
||||||
Pdfpagelabels.startvalue = startval + addition}
|
Pdfpagelabels.startvalue = startval + if progress then addition else 0}
|
||||||
in
|
in
|
||||||
labels := Pdfpagelabels.add_label (Pdfpage.endpage pdf) !labels label e)
|
labels := Pdfpagelabels.add_label (Pdfpage.endpage pdf) !labels label e)
|
||||||
ranges
|
ranges
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
%Document \n in bookmark files
|
%Document \n in bookmark files
|
||||||
|
%Document -labels-progress
|
||||||
\documentclass{book}
|
\documentclass{book}
|
||||||
\usepackage{palatino}
|
\usepackage{palatino}
|
||||||
\usepackage{microtype}
|
\usepackage{microtype}
|
||||||
|
|
Loading…
Reference in New Issue