mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-02-10 00:40:52 +01:00
Added support for listing bookmarks with full destinations
This commit is contained in:
parent
4eab7ebdd7
commit
51e7689fd1
13
cpdf.ml
13
cpdf.ml
@ -1167,6 +1167,14 @@ let remove_metadata pdf =
|
|||||||
rootnum}
|
rootnum}
|
||||||
|
|
||||||
(* List bookmarks *)
|
(* 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 *)
|
(* List the bookmarks, optionally deunicoding the text, in the given range to the given output *)
|
||||||
let list_bookmarks encoding range pdf output =
|
let list_bookmarks encoding range pdf output =
|
||||||
@ -1214,11 +1222,12 @@ let list_bookmarks encoding range pdf output =
|
|||||||
iter
|
iter
|
||||||
(function mark ->
|
(function mark ->
|
||||||
output.Pdfio.output_string
|
output.Pdfio.output_string
|
||||||
(Printf.sprintf "%i \"%s\" %i %s\n"
|
(Printf.sprintf "%i \"%s\" %i %s %s\n"
|
||||||
mark.Pdfmarks.level
|
mark.Pdfmarks.level
|
||||||
(process_string mark.Pdfmarks.text)
|
(process_string mark.Pdfmarks.text)
|
||||||
(Pdfpage.pagenumber_of_target ~fastrefnums pdf mark.Pdfmarks.target)
|
(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
|
inrange
|
||||||
|
|
||||||
(* o is the stamp, u is the main pdf page *)
|
(* o is the stamp, u is the main pdf page *)
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
let demo = false
|
let demo = false
|
||||||
let noncomp = false
|
let noncomp = false
|
||||||
let major_version = 2
|
let major_version = 2
|
||||||
let minor_version = 2
|
let minor_version = 3
|
||||||
let version_date = "(patchlevel 1, build of 1st September 2017)"
|
let version_date = "(devel, build of 4th November 2017)"
|
||||||
|
|
||||||
open Pdfutil
|
open Pdfutil
|
||||||
open Pdfio
|
open Pdfio
|
||||||
|
Loading…
x
Reference in New Issue
Block a user