diff --git a/cpdf.ml b/cpdf.ml index f6b5f2f..6be6668 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -1167,6 +1167,14 @@ let remove_metadata pdf = rootnum} (* List bookmarks *) +let output_string_of_target pdf fastrefnums x = + match Pdfdest.pdfobject_of_destination x with + | Pdf.Array (Pdf.Indirect targetobjnum::more) -> + let a = + Pdf.Array (Pdf.Integer (Pdfpage.pagenumber_of_target ~fastrefnums pdf x)::more) + in + "\"" ^ Pdfwrite.string_of_pdf a ^ "\"" + | _ -> "" (* List the bookmarks, optionally deunicoding the text, in the given range to the given output *) let list_bookmarks encoding range pdf output = @@ -1214,11 +1222,12 @@ let list_bookmarks encoding range pdf output = iter (function mark -> output.Pdfio.output_string - (Printf.sprintf "%i \"%s\" %i %s\n" + (Printf.sprintf "%i \"%s\" %i %s %s\n" mark.Pdfmarks.level (process_string mark.Pdfmarks.text) (Pdfpage.pagenumber_of_target ~fastrefnums pdf mark.Pdfmarks.target) - (if mark.Pdfmarks.isopen then "open" else ""))) + (if mark.Pdfmarks.isopen then "open" else "") + (output_string_of_target pdf fastrefnums mark.Pdfmarks.target))) inrange (* o is the stamp, u is the main pdf page *) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 7697a6f..a178f16 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -2,8 +2,8 @@ let demo = false let noncomp = false let major_version = 2 -let minor_version = 2 -let version_date = "(patchlevel 1, build of 1st September 2017)" +let minor_version = 3 +let version_date = "(devel, build of 4th November 2017)" open Pdfutil open Pdfio