mirror of
				https://github.com/johnwhitington/cpdf-source.git
				synced 2025-06-05 22:09:39 +02:00 
			
		
		
		
	File removal and error handling
This commit is contained in:
		| @@ -5,7 +5,7 @@ open Cpdferror | |||||||
| let debug_image_processing = ref false | let debug_image_processing = ref false | ||||||
|  |  | ||||||
| let remove x = | let remove x = | ||||||
|   try Sys.remove x with _ -> () |   try (*Printf.printf "%s\n" x;*) Sys.remove x with _ -> () | ||||||
|  |  | ||||||
| let pnm_white ch = output_char ch ' ' | let pnm_white ch = output_char ch ' ' | ||||||
| let pnm_newline ch = output_char ch '\n' | let pnm_newline ch = output_char ch '\n' | ||||||
| @@ -762,6 +762,7 @@ let preprocess_jbig2_lossy ~path_to_jbig2enc ~length_threshold ~pixel_threshold | |||||||
|      in |      in | ||||||
|        (*Printf.printf "%S\n" command;*) Sys.command command |        (*Printf.printf "%S\n" command;*) Sys.command command | ||||||
|    in |    in | ||||||
|  |    iter remove (map snd !objnum_name_pairs); | ||||||
|    if retcode = 0 then |    if retcode = 0 then | ||||||
|      begin |      begin | ||||||
|        let globals = bytes_of_string (contents_of_file (jbig2out ^ ".sym")) in |        let globals = bytes_of_string (contents_of_file (jbig2out ^ ".sym")) in | ||||||
| @@ -790,6 +791,12 @@ let preprocess_jbig2_lossy ~path_to_jbig2enc ~length_threshold ~pixel_threshold | |||||||
|            !objnum_name_pairs |            !objnum_name_pairs | ||||||
|            (indx0 !objnum_name_pairs) |            (indx0 !objnum_name_pairs) | ||||||
|      end |      end | ||||||
|  |    else | ||||||
|  |      begin | ||||||
|  |        Pdfe.log "Call to jbig2enc failed" | ||||||
|  |      end; | ||||||
|  |    iter (fun i -> remove (jbig2out ^ Printf.sprintf ".%04i" i)) (indx0 !objnum_name_pairs); | ||||||
|  |    remove (jbig2out ^ ".sym") | ||||||
|  |  | ||||||
| let process | let process | ||||||
|   ?q ?qlossless ?onebppmethod ~length_threshold ~percentage_threshold ~pixel_threshold ~dpi_threshold |   ?q ?qlossless ?onebppmethod ~length_threshold ~percentage_threshold ~pixel_threshold ~dpi_threshold | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user