diff --git a/cpdfembed.ml b/cpdfembed.ml index 8cddbbb..6922438 100644 --- a/cpdfembed.ml +++ b/cpdfembed.ml @@ -83,7 +83,7 @@ let make_fontpack_hashtable fs = (fun u -> match charcode_extractor u with | Some x -> Hashtbl.add table u (i, x) - | None -> Printf.printf "charcode_extractor could not find char in make_fontpack_hashtable\n") + | None -> Printf.printf "charcode_extractor could not find char U+%04x in make_fontpack_hashtable\n" u) subset) indexes fs; table diff --git a/cpdftoc.ml b/cpdftoc.ml index ba55796..9ed5014 100644 --- a/cpdftoc.ml +++ b/cpdftoc.ml @@ -138,6 +138,9 @@ let add_to_parent_tree pdf p = begin match lookup "/ParentTree" d with | Some (Pdf.Indirect i) -> Pdf.addobj_given_num pdf (i, newtree) + | Some (Pdf.Dictionary d) -> + let i = Pdf.addobj pdf newtree in + Pdf.replace_chain pdf ["/Root"; "/StructTreeRoot"; "/ParentTree"] (Pdf.Indirect i) | _ -> () end | _ -> ()