All TOC PDF/UA examples now work

This commit is contained in:
John Whitington 2025-03-08 15:55:45 +00:00
parent b4514e3418
commit 502f51b671
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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
| _ -> ()