roundtripping of bookmarks done

This commit is contained in:
John Whitington 2019-07-07 14:20:43 +01:00
parent 2b8a334190
commit 3ec1628d7a
2 changed files with 8 additions and 7 deletions

14
cpdf.ml
View File

@ -1018,12 +1018,12 @@ let bookmark_of_data pdf i s i' isopen optionaldest =
None ->
raise (Pdf.PDFError "bookmark_of_data: page obj num not found")
| Some p ->
Pdfdest.read_destination
(Pdf.empty ())
(Pdf.Array (Pdf.Indirect p::more))
Pdfdest.read_destination pdf (Pdf.Array (Pdf.Indirect p::more))
end
| _ ->
raise (Pdf.PDFError "bookmark_of_data: dest")
(* Need to deal with "null", "(string)", and "<<other thing like action" *)
| Pdf.Null -> Pdfdest.NullDestination
| Pdf.String s -> Pdfdest.read_destination pdf (Pdf.String s)
| x -> Pdfdest.Action x
end
| _ -> Pdfpage.target_of_pagenumber pdf i'
in
@ -1296,11 +1296,11 @@ let list_bookmarks encoding range pdf output =
iter
(function mark ->
output.Pdfio.output_string
(Printf.sprintf "%i \"%s\" %i %s %s\n"
(Printf.sprintf "%i \"%s\" %i%s %s\n"
mark.Pdfmarks.level
(process_string mark.Pdfmarks.text)
(calculate_page_number mark)
(if mark.Pdfmarks.isopen then "open" else "")
(if mark.Pdfmarks.isopen then " open" else "")
(output_string_of_target pdf fastrefnums mark.Pdfmarks.target)))
inrange

View File

@ -22,6 +22,7 @@
%FIXME: Document -gs gs -gs-embed-fonts
%FIXME: Document -merge-add-bookmarks, -merge-add-bookmarks-use-titles
%FIXME: Document -bookmarks-open-to-level <n>
%FIXME: Explain in key places that you probably want UTF8 a lot
\documentclass{book}
\usepackage{palatino}