mirror of
				https://github.com/johnwhitington/cpdf-source.git
				synced 2025-06-05 22:09:39 +02:00 
			
		
		
		
	First working -jbig2
This commit is contained in:
		| @@ -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_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 = | ||||
|   match font with | ||||
| @@ -1915,6 +1916,9 @@ and specs = | ||||
|    ("-jpeg", | ||||
|        Arg.String set_input_jpeg, | ||||
|        " Load from a JPEG file, converting to PDF"); | ||||
|    ("-jbig2", | ||||
|        Arg.String set_input_jbig2, | ||||
|        " Load from a JBIG2 fragment, converting to PDF"); | ||||
|    ("-idir", | ||||
|        Arg.String set_input_dir, | ||||
|        " 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; | ||||
|      "/Height", Pdf.Integer png.height] | ||||
|   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 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 obj_of_jpeg_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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user