1 --- pdfsandwich.ml 2011-09-25 13:20:10.123429858 +0200
2 +++ pdfsandwich.ml.new 2011-09-25 13:21:17.506759118 +0200
4 pr ("\nParallel processing with " ^ (string_of_int nthreads) ^ " threads started.\nProcessing page order may differ from original page order.\n");
6 let process_page (curr_page, pdfname) =
7 - let tmppicfile = Filename.temp_file "pdfsandwich" ".bmp" in
8 + let tmppicfile = Filename.temp_file "pdfsandwich" ".tiff" in
9 let tmpocrfile = Filename.temp_file "pdfsandwich" ".hOCR" in
10 let tmpcolfigfile = Filename.temp_file "pdfsandwich" "_col.bmp" in
12 Printf.printf "Processing page %i.\n" curr_page;
14 - run (!convert ^ " " ^ convertopts ^ " -type Bilevel -density " ^ resolution ^ " \"" ^ infile ^ "[" ^ (string_of_int (curr_page-1)) ^ "]\" BMP3:" ^ tmppicfile);
15 + run (!convert ^ " " ^ convertopts ^ " -type Bilevel -density " ^ resolution ^ " \"" ^ infile ^ "[" ^ (string_of_int (curr_page-1)) ^ "]\" TIFF:" ^ tmppicfile);
16 let cunout = if not !verbose then ">/dev/null 2>&1" else "" in
17 run (!cuneiform ^ " " ^ cuniopts ^ " -l " ^ language ^ " -f hocr -o " ^ tmpocrfile ^ " " ^ tmppicfile ^ cunout);
20 let pdffilenamelist = List.map snd (Array.to_list tmppdf_arr) in
21 let pdfliststring = String.concat " " pdffilenamelist in
22 pr ("OCR done. Writing \"" ^ outfile ^ "\"");
23 - run (!gs ^ " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=\"" ^ outfile ^ "\" " ^ pdfliststring);
24 + run (!gs ^ " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=\"" ^ outfile ^ "\" " ^ pdfliststring);
25 List.iter Sys.remove pdffilenamelist;