|
|
|
@ -99,19 +99,25 @@ class PDF { |
|
|
|
|
* @param bool Whether to print the header, footer and watermark (true) or just the content (false) |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
public function html_to_pdf($html_file_array, $pdf_name = '', $course_code = null, $print_title = false, $complete_style = true) { |
|
|
|
|
if ($complete_style === false) { error_log(__FUNCTION__.' with no style'); } |
|
|
|
|
public function html_to_pdf($html_file_array, $pdf_name = '', $course_code = null, $print_title = false, $complete_style = true) |
|
|
|
|
{ |
|
|
|
|
if ($complete_style === false) { |
|
|
|
|
error_log(__FUNCTION__.' with no style'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($html_file_array)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (is_array($html_file_array)) { |
|
|
|
|
if (count($html_file_array) == 0) |
|
|
|
|
if (count($html_file_array) == 0) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (!file_exists($html_file_array)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Converting the string into an array |
|
|
|
|
$html_file_array = array($html_file_array); |
|
|
|
|
} |
|
|
|
@ -151,7 +157,7 @@ class PDF { |
|
|
|
|
$html_title = $file['title']; |
|
|
|
|
$file = $file['path']; |
|
|
|
|
} else { |
|
|
|
|
//we suppose we've only been sent a file path |
|
|
|
|
// We suppose we've only been sent a file path. |
|
|
|
|
$html_title = basename($file); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -193,7 +199,6 @@ class PDF { |
|
|
|
|
$absolute_css_path = api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/frames.css'; |
|
|
|
|
$document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($course_data['path'])) { |
|
|
|
|
$document_html= str_replace('../', '', $document_html); |
|
|
|
|
$document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
|
|
|
|