From 3ec1628d7a965c73daf1f9ae5e21fdbab78826af Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 7 Jul 2019 14:20:43 +0100 Subject: [PATCH] roundtripping of bookmarks done --- cpdf.ml | 14 +++++++------- cpdfmanual.tex | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cpdf.ml b/cpdf.ml index e27e5af..a3bb28d 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -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 "< 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 diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 78cb8f2..f1b4eea 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -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 +%FIXME: Explain in key places that you probably want UTF8 a lot \documentclass{book} \usepackage{palatino}