@@ -1023,10 +1023,12 @@ function _os2web_cp_service_document_convert($file_id, $path_to_pdf){
1023
1023
->condition('file_id', $file_id)
1024
1024
->execute();
1025
1025
} else {
1026
- shell_exec('pdf2htmlEX ' . $path_to_pdf . ' --dest-dir ' . file_directory_temp());
1026
+ $file_name = explode('/', $path_to_pdf);
1027
+
1028
+ shell_exec('pdf2htmlEX ' . $path_to_pdf . ' --single-html 0 --dest-dir ' . file_directory_temp() . '/' . $file_id);//saving in separate directory
1027
1029
db_update('os2web_cp_service_documents_conversion')
1028
1030
->fields(array(
1029
- 'filepath_html' => $path_to_pdf . '.html',
1031
+ 'filepath_html' => file_directory_temp() . '/' . $file_id . '/' . end($file_name) . '.html',
1030
1032
'status' => 'converted',
1031
1033
))
1032
1034
->condition('file_id', $file_id)
@@ -1071,7 +1073,7 @@ function _os2web_cp_service_update_case_metadata($file_id, $case_nid, $path_to_p
1071
1073
1072
1074
//html tags removing
1073
1075
$text = str_replace('<p> </p>', ' ', $text); //removing unneeded paragraphs
1074
- $text = preg_replace('#<style(.*?)>(.*?)</style>#is', ' ', $text);//removing style tags
1076
+ // $text = preg_replace('#<style(.*?)>(.*?)</style>#is', ' ', $text);//removing style tags
1075
1077
$text = preg_replace('#<script(.*?)>(.*?)</script>#is', ' ', $text);//removing scripts tags
1076
1078
$text = str_replace("\r\n", " ", strip_tags($text));
1077
1079
$text = str_replace("\n\r", " ", $text);
@@ -1090,7 +1092,7 @@ function _os2web_cp_service_update_case_metadata($file_id, $case_nid, $path_to_p
1090
1092
->execute();
1091
1093
1092
1094
//tmp files cleanup
1093
- unlink($path_to_html );
1095
+ file_unmanaged_delete_recursive(file_directory_temp() . '/' . $file_id );
1094
1096
unlink($path_to_pdf);
1095
1097
}
1096
1098
}
0 commit comments