First working -jbig2
This commit is contained in:
parent
9ad38424f7
commit
0d97d39c02
|
@ -1789,6 +1789,7 @@ let set_input_image f s =
|
||||||
|
|
||||||
let set_input_png = set_input_image Cpdfimage.obj_of_png_data
|
let set_input_png = set_input_image Cpdfimage.obj_of_png_data
|
||||||
let set_input_jpeg = set_input_image Cpdfimage.obj_of_jpeg_data
|
let set_input_jpeg = set_input_image Cpdfimage.obj_of_jpeg_data
|
||||||
|
let set_input_jbig2 = set_input_image (Cpdfimage.obj_of_jbig2_data ~global:1)
|
||||||
|
|
||||||
let embed_font_inner font =
|
let embed_font_inner font =
|
||||||
match font with
|
match font with
|
||||||
|
@ -1915,6 +1916,9 @@ and specs =
|
||||||
("-jpeg",
|
("-jpeg",
|
||||||
Arg.String set_input_jpeg,
|
Arg.String set_input_jpeg,
|
||||||
" Load from a JPEG file, converting to PDF");
|
" Load from a JPEG file, converting to PDF");
|
||||||
|
("-jbig2",
|
||||||
|
Arg.String set_input_jbig2,
|
||||||
|
" Load from a JBIG2 fragment, converting to PDF");
|
||||||
("-idir",
|
("-idir",
|
||||||
Arg.String set_input_dir,
|
Arg.String set_input_dir,
|
||||||
" Add a directory of files");
|
" Add a directory of files");
|
||||||
|
|
17
cpdfimage.ml
17
cpdfimage.ml
|
@ -405,7 +405,22 @@ let obj_of_png_data data =
|
||||||
"/Width", Pdf.Integer png.width;
|
"/Width", Pdf.Integer png.width;
|
||||||
"/Height", Pdf.Integer png.height]
|
"/Height", Pdf.Integer png.height]
|
||||||
in
|
in
|
||||||
Pdf.Stream {contents = (Pdf.Dictionary d , Pdf.Got png.idat)}
|
Pdf.Stream {contents = (Pdf.Dictionary d, Pdf.Got png.idat)}
|
||||||
|
|
||||||
|
let obj_of_jbig2_data ?global:int data =
|
||||||
|
let d =
|
||||||
|
let w = 800 in
|
||||||
|
let h = 1200 in
|
||||||
|
[("/Length", Pdf.Integer (Pdfio.bytes_size data));
|
||||||
|
("/Filter", Pdf.Name "/JBIG2Decode");
|
||||||
|
("/Subtype", Pdf.Name "/Image");
|
||||||
|
("/BitsPerComponent", Pdf.Integer 1);
|
||||||
|
("/ColorSpace", Pdf.Name "/DeviceGray");
|
||||||
|
(* FIXME decodeparms for global *)
|
||||||
|
("/Width", Pdf.Integer w);
|
||||||
|
("/Height", Pdf.Integer h)]
|
||||||
|
in
|
||||||
|
Pdf.Stream {contents = (Pdf.Dictionary d, Pdf.Got data)}
|
||||||
|
|
||||||
let image_of_input fobj i =
|
let image_of_input fobj i =
|
||||||
let pdf = Pdf.empty () in
|
let pdf = Pdf.empty () in
|
||||||
|
|
|
@ -15,3 +15,4 @@ val images : Pdf.t -> int list -> Cpdfyojson.Safe.t
|
||||||
val image_of_input : (Pdfio.bytes -> Pdf.pdfobject) -> Pdfio.input -> Pdf.t
|
val image_of_input : (Pdfio.bytes -> Pdf.pdfobject) -> Pdfio.input -> Pdf.t
|
||||||
val obj_of_jpeg_data : Pdfio.bytes -> Pdf.pdfobject
|
val obj_of_jpeg_data : Pdfio.bytes -> Pdf.pdfobject
|
||||||
val obj_of_png_data : Pdfio.bytes -> Pdf.pdfobject
|
val obj_of_png_data : Pdfio.bytes -> Pdf.pdfobject
|
||||||
|
val obj_of_jbig2_data : ?global:int -> Pdfio.bytes -> Pdf.pdfobject
|
||||||
|
|
Loading…
Reference in New Issue