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