mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-03-02 18:47:54 +01:00
Add header for files with no struct tree
This commit is contained in:
parent
9af12f1ae0
commit
17762e35a0
@ -334,15 +334,15 @@ let mark pdf =
|
|||||||
let extract_struct_tree pdf =
|
let extract_struct_tree pdf =
|
||||||
match Pdf.lookup_obj pdf pdf.Pdf.root with
|
match Pdf.lookup_obj pdf pdf.Pdf.root with
|
||||||
| Pdf.Dictionary d ->
|
| Pdf.Dictionary d ->
|
||||||
begin match lookup "/StructTreeRoot" d with
|
|
||||||
| None -> `List []
|
|
||||||
| Some x ->
|
|
||||||
let objs = Pdf.objects_referenced ["/Pg"; "/Obj"; "/Stm"; "/StmOwn"] [] pdf x in
|
|
||||||
let zero =
|
let zero =
|
||||||
`List [`Int 0;
|
`List [`Int 0;
|
||||||
`Assoc [("/CPDFJSONformatversion", `Int 1);
|
`Assoc [("/CPDFJSONformatversion", `Int 1);
|
||||||
("/CPDFJSONpageobjnumbers", `List (map (fun x -> `Int (unopt (Pdfpage.page_object_number pdf x))) (ilist 1 (Pdfpage.endpage pdf))))]]
|
("/CPDFJSONpageobjnumbers", `List (map (fun x -> `Int (unopt (Pdfpage.page_object_number pdf x))) (ilist 1 (Pdfpage.endpage pdf))))]]
|
||||||
in
|
in
|
||||||
|
begin match lookup "/StructTreeRoot" d with
|
||||||
|
| None -> `List [zero]
|
||||||
|
| Some x ->
|
||||||
|
let objs = Pdf.objects_referenced ["/Pg"; "/Obj"; "/Stm"; "/StmOwn"] [] pdf x in
|
||||||
`List
|
`List
|
||||||
(zero::map
|
(zero::map
|
||||||
(fun objnum ->
|
(fun objnum ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user