ocg list split
This commit is contained in:
parent
17f90f890d
commit
c122df5dc5
12
cpdf.ml
12
cpdf.ml
|
@ -4459,8 +4459,9 @@ let ocg_coalesce pdf =
|
||||||
pdf.Pdf.root <- new_catalog;
|
pdf.Pdf.root <- new_catalog;
|
||||||
Pdf.objselfmap (Pdf.renumber_object_parsed pdf (hashtable_of_dictionary changes)) pdf
|
Pdf.objselfmap (Pdf.renumber_object_parsed pdf (hashtable_of_dictionary changes)) pdf
|
||||||
|
|
||||||
let ocg_list pdf =
|
let ocg_get_list pdf =
|
||||||
match Pdf.lookup_direct pdf "/OCProperties" (Pdf.catalog_of_pdf pdf) with
|
let l = ref [] in
|
||||||
|
begin match Pdf.lookup_direct pdf "/OCProperties" (Pdf.catalog_of_pdf pdf) with
|
||||||
None -> ()
|
None -> ()
|
||||||
| Some ocpdict ->
|
| Some ocpdict ->
|
||||||
match Pdf.lookup_direct pdf "/OCGs" ocpdict with
|
match Pdf.lookup_direct pdf "/OCGs" ocpdict with
|
||||||
|
@ -4469,10 +4470,15 @@ let ocg_list pdf =
|
||||||
(function
|
(function
|
||||||
Pdf.Indirect i ->
|
Pdf.Indirect i ->
|
||||||
(match Pdf.lookup_direct pdf "/Name" (Pdf.lookup_obj pdf i) with
|
(match Pdf.lookup_direct pdf "/Name" (Pdf.lookup_obj pdf i) with
|
||||||
Some (Pdf.String s) -> Printf.printf "%s\n" s | _ -> ())
|
Some (Pdf.String s) -> l := s::!l | _ -> ())
|
||||||
| _ -> ())
|
| _ -> ())
|
||||||
elts
|
elts
|
||||||
| _ -> ()
|
| _ -> ()
|
||||||
|
end;
|
||||||
|
rev !l
|
||||||
|
|
||||||
|
let ocg_list pdf =
|
||||||
|
List.iter (Printf.printf "%s\n") (ocg_get_list pdf)
|
||||||
|
|
||||||
let ocg_rename f t pdf =
|
let ocg_rename f t pdf =
|
||||||
Pdf.objselfmap
|
Pdf.objselfmap
|
||||||
|
|
2
cpdf.mli
2
cpdf.mli
|
@ -459,6 +459,8 @@ val append_page_content : string -> bool -> bool -> int list -> Pdf.t -> Pdf.t
|
||||||
|
|
||||||
val ocg_coalesce : Pdf.t -> unit
|
val ocg_coalesce : Pdf.t -> unit
|
||||||
|
|
||||||
|
val ocg_get_list : Pdf.t -> string list
|
||||||
|
|
||||||
val ocg_list : Pdf.t -> unit
|
val ocg_list : Pdf.t -> unit
|
||||||
|
|
||||||
val ocg_rename : string -> string -> Pdf.t -> unit
|
val ocg_rename : string -> string -> Pdf.t -> unit
|
||||||
|
|
Loading…
Reference in New Issue