Make sure JPEG2000 images are listed

This commit is contained in:
John Whitington 2024-03-22 15:33:08 +00:00
parent 5f8c53eb14
commit b332018081
3 changed files with 8 additions and 5 deletions

View File

@ -4244,9 +4244,11 @@ let go () =
begin match json with
| `List l ->
iter
(function (`Assoc [(_, `Int i); (_, `List pages); (_, `String name); (_, `Int w); (_, `Int h); (_, `Int size); (_, `Int bpc); (_, `String cs); (_, `String filter)]) ->
(function (`Assoc [(_, `Int i); (_, `List pages); (_, `String name); (_, `Int w); (_, `Int h); (_, `Int size); (_, bpc); (_, cs); (_, `String filter)]) ->
let pages = combine_with_spaces (map (function `Int i -> string_of_int i | _ -> "") pages) in
flprint (Printf.sprintf "%i, %s, %s, %i, %i, %i, %i, %s, %s\n" i pages name w h size bpc cs filter)
let bpc = match bpc with `Int bpc -> string_of_int bpc | _ -> "none" in
let cs = match cs with `String cs -> cs | _ -> "none" in
flprint (Printf.sprintf "%i, %s, %s, %i, %i, %i, %s, %s, %s\n" i pages name w h size bpc cs filter)
| _ -> ())
l
| _ -> ()

View File

@ -365,8 +365,8 @@ let images pdf range =
| _ -> 0
and bpc =
match Pdf.lookup_direct pdf "/BitsPerComponent" xobject with
| Some (Pdf.Integer x) -> x
| _ -> 0
| Some (Pdf.Integer x) -> Some x
| _ -> None
and colourspace =
match Pdf.lookup_direct pdf "/ColorSpace" xobject with
| Some x -> Some (Pdfspace.string_of_colourspace (Pdfspace.read_colourspace pdf resources x))
@ -420,7 +420,7 @@ let images pdf range =
("Width", `Int w);
("Height", `Int h);
("Bytes", `Int size);
("BitsPerComponent", `Int bpc);
("BitsPerComponent", match bpc with None -> `Null | Some bpc -> `Int bpc);
("Colourspace", match cs with None -> `Null | Some s -> `String s);
("Filter", match filter with None -> `Null | Some s -> `String s)])
images)

View File

@ -1,3 +1,4 @@
%Document JPEG2000 embedding
\documentclass{book}
% Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf,
% dotnetcpdflibmanual.pdf, jcpdflibmanual.pdf jscpdflibmanual.pdf etc.