|
|
|
@ -177,9 +177,12 @@ class PDF |
|
|
|
* 0 => array('title'=>'Hello','path'=>'file.html'), |
|
|
|
* 0 => array('title'=>'Hello','path'=>'file.html'), |
|
|
|
* 1 => array('title'=>'Bye','path'=>'file2.html') |
|
|
|
* 1 => array('title'=>'Bye','path'=>'file2.html') |
|
|
|
* ); |
|
|
|
* ); |
|
|
|
* @param string pdf name |
|
|
|
* @param string $pdf_name pdf name |
|
|
|
* @param string course code (if you are using html that are located in the document tool you must provide this) |
|
|
|
* @param string $course_code (if you are using html that are located in the document tool you must provide this) |
|
|
|
* @param bool Whether to print the header, footer and watermark (true) or just the content (false) |
|
|
|
* @param bool $print_title add title |
|
|
|
|
|
|
|
* @param bool $complete_style show header and footer if true |
|
|
|
|
|
|
|
* @param bool $addStyle |
|
|
|
|
|
|
|
* |
|
|
|
* @return bool |
|
|
|
* @return bool |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function html_to_pdf( |
|
|
|
public function html_to_pdf( |
|
|
|
@ -190,10 +193,6 @@ class PDF |
|
|
|
$complete_style = true, |
|
|
|
$complete_style = true, |
|
|
|
$addStyle = true |
|
|
|
$addStyle = true |
|
|
|
) { |
|
|
|
) { |
|
|
|
if ($complete_style === false) { |
|
|
|
|
|
|
|
error_log(__FUNCTION__.' with no style'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($html_file_array)) { |
|
|
|
if (empty($html_file_array)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -224,6 +223,7 @@ class PDF |
|
|
|
|
|
|
|
|
|
|
|
// Formatting the pdf |
|
|
|
// Formatting the pdf |
|
|
|
self::format_pdf($course_data, $complete_style); |
|
|
|
self::format_pdf($course_data, $complete_style); |
|
|
|
|
|
|
|
|
|
|
|
$counter = 1; |
|
|
|
$counter = 1; |
|
|
|
foreach ($html_file_array as $file) { |
|
|
|
foreach ($html_file_array as $file) { |
|
|
|
//Add a page break per file |
|
|
|
//Add a page break per file |
|
|
|
@ -261,7 +261,6 @@ class PDF |
|
|
|
if ($addStyle) { |
|
|
|
if ($addStyle) { |
|
|
|
$css_file = api_get_path(SYS_CSS_PATH).'/print.css'; |
|
|
|
$css_file = api_get_path(SYS_CSS_PATH).'/print.css'; |
|
|
|
$css = file_exists($css_file) ? @file_get_contents($css_file) : ''; |
|
|
|
$css = file_exists($css_file) ? @file_get_contents($css_file) : ''; |
|
|
|
|
|
|
|
|
|
|
|
$this->pdf->WriteHTML($css, 1); |
|
|
|
$this->pdf->WriteHTML($css, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -328,7 +327,6 @@ class PDF |
|
|
|
if (strpos($old_src, 'courses/'.$course_data['path'].'/document/') !== false) { |
|
|
|
if (strpos($old_src, 'courses/'.$course_data['path'].'/document/') !== false) { |
|
|
|
$old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src); |
|
|
|
$old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
// Try with the dirname if exists |
|
|
|
// Try with the dirname if exists |
|
|
|
if (file_exists($dirName.'/'.$old_src)) { |
|
|
|
if (file_exists($dirName.'/'.$old_src)) { |
|
|
|
$document_path = ''; |
|
|
|
$document_path = ''; |
|
|
|
@ -838,7 +836,10 @@ class PDF |
|
|
|
$watermark_text = api_get_setting('pdf_export_watermark_text'); |
|
|
|
$watermark_text = api_get_setting('pdf_export_watermark_text'); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!empty($watermark_text)) { |
|
|
|
if (!empty($watermark_text)) { |
|
|
|
$this->pdf->SetWatermarkText(strcode2utf($watermark_text),0.1); |
|
|
|
$this->pdf->SetWatermarkText( |
|
|
|
|
|
|
|
strcode2utf($watermark_text), |
|
|
|
|
|
|
|
0.1 |
|
|
|
|
|
|
|
); |
|
|
|
$this->pdf->showWatermarkText = true; |
|
|
|
$this->pdf->showWatermarkText = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|