let rec print_file ?(html=false) file report =
try
let chanout = open_out file in
let fmt = Format.formatter_of_out_channel chanout in
print_fmt ~html fmt report;
close_out chanout
with
Sys_error s ->
raise (Failure s)