Bookmark @B on splitting now dowes utf8, raw

This commit is contained in:
John Whitington 2019-07-07 12:55:15 +01:00
parent 9f981fb344
commit 2b8a334190
1 changed files with 14 additions and 13 deletions

View File

@ -2600,12 +2600,13 @@ let write_pdf ?(encryption = None) ?(is_decompress=false) mk_id pdf =
(* Returns empty string on failure. Should only be used in conjunction with
split at bookmarks code, so should never fail, by definiton. *)
let remove_unsafe_characters s =
if args.encoding = Cpdf.Raw then s else
let chars =
lose
(function x ->
match x with
'/' | '?' | '<' | '>' | '\\' | ':' | '*' | '|' | '\"' | '^' | '+' | '=' -> true
| x when int_of_char x < 32 || int_of_char x > 126 -> true
| x when int_of_char x < 32 || (int_of_char x > 126 && args.encoding <> Cpdf.Stripped) -> true
| _ -> false)
(explode s)
in
@ -3503,7 +3504,7 @@ let bookmarks_open_to_level n pdf =
let marks = Pdfmarks.read_bookmarks pdf in
let newmarks =
List.map
(fun m -> {m with Pdfmarks.isopen = true(*m.Pdfmarks.level < n*)})
(fun m -> {m with Pdfmarks.isopen = m.Pdfmarks.level < n})
marks
in
Pdfmarks.add_bookmarks newmarks pdf