Implement -print-page-labels-json
This commit is contained in:
parent
122285db59
commit
45c8213e80
|
@ -4149,6 +4149,16 @@ let go () =
|
|||
write_pdf false pdf
|
||||
| Some PrintPageLabels ->
|
||||
let pdf = get_single_pdf args.op true in
|
||||
if args.format_json then
|
||||
let json_of_pagelabel l =
|
||||
`Assoc
|
||||
[("labelstyle", `String (Pdfpagelabels.string_of_labelstyle l.Pdfpagelabels.labelstyle));
|
||||
("labelprefix", begin match l.Pdfpagelabels.labelprefix with None -> `Null | Some s -> `String s end);
|
||||
("startpage", `Int l.Pdfpagelabels.startpage);
|
||||
("startvalue", `Int l.Pdfpagelabels.startvalue)]
|
||||
in
|
||||
flprint (Cpdfyojson.Safe.pretty_to_string (`List (map json_of_pagelabel (Pdfpagelabels.read pdf))))
|
||||
else
|
||||
iter
|
||||
print_string
|
||||
(map Pdfpagelabels.string_of_pagelabel (Pdfpagelabels.read pdf))
|
||||
|
|
Loading…
Reference in New Issue