104 $this->$property = $default;
105 if (isset($this->moduleConfigs[
$name])) {
106 $value = $this->moduleConfigs[
$name];
107 $this->$property = empty($value) ? $default : $value;
117 unset($this->pdfEngine);
119 unset($this->pdfAuthor);
120 unset($this->pdfTitle);
121 unset($this->pdfSubject);
122 unset($this->pdfKeywords);
126 $this->
setFromConfigs(
'page_orientation',
'pageOrientation',
'P');
172 return 'Simple HTML to PDF using TCPDF.';
186 if (isset($this->pdfEngine)) {
187 $this->pdfEngine->setPageOrientation($this->pageOrientation,
true, $this->bottomMargin);
202 if (isset($this->pdfEngine)) {
203 $this->pdfEngine->setPageFormat($this->pageSize, $this->pageOrientation);
219 if (isset($this->pdfEngine)) {
220 $this->pdfEngine->setPageUnit(
$unit);
241 if (isset($this->pdfEngine)) {
242 $this->pdfEngine->SetMargins($this->leftMargin, $this->topMargin, $this->rightMargin);
243 if (empty($this->bottomMargin)) {
244 $this->bottomMargin = PDF_MARGIN_BOTTOM;
246 $this->pdfEngine->SetAutoPageBreak(
true, $this->bottomMargin);
265 if (isset($this->pdfEngine)) {
266 $this->pdfEngine->SetFont($this->fontFamily, $this->fontStyle, $this->fontSize);
281 if (isset($this->pdfEngine)) {
282 $this->pdfEngine->SetDefaultMonospacedFont($this->monoFontFamily);
297 if (isset($this->pdfEngine)) {
298 $this->pdfEngine->SetAuthor($this->pdfAuthor);
313 if (isset($this->pdfEngine)) {
314 $this->pdfEngine->SetTitle($this->pdfTitle);
329 if (isset($this->pdfEngine)) {
330 $this->pdfEngine->SetSubject($this->pdfSubject);
345 if (isset($this->pdfEngine)) {
347 is_array($this->pdfKeywords) ? implode(
', ', $this->pdfKeywords) : (string) $this->pdfKeywords;
348 $this->pdfEngine->SetKeywords($keywords);
364 $this->pdfEngine->AddPage();
365 $this->pdfEngine->writeHTML(
$html,
true,
false,
true,
false,
'');
380 $name =
'requested.pdf';
382 $this->pdfEngine->lastPage();
383 $this->pdfEngine->Output(
$name,
'I');
398 $name =
'requested.pdf';
400 $this->pdfEngine->lastPage();
401 $this->pdfEngine->Output(
$name,
'D');
414 $this->pdfEngine->lastPage();
415 $response->seValue($this->pdfEngine->Output(
'',
'S'));
425 if (empty($this->pdfEngine)) {
426 $this->pdfEngine =
new TCPDF($this->pageOrientation, $this->unit, $this->pageSize,
true,
'UTF-8',
false);
427 if (isset($this->pdfAuthor)) {
428 $this->pdfEngine->SetAuthor($this->pdfAuthor);
430 if (isset($this->pdfTitle)) {
431 $this->pdfEngine->SetTitle($this->pdfTitle);
433 if (isset($this->pdfSubject)) {
434 $this->pdfEngine->SetSubject($this->pdfSubject);
436 if (isset($this->pdfKeywords)) {
438 is_array($this->pdfKeywords) ? implode(
', ', $this->pdfKeywords) : (string) $this->pdfKeywords;
439 $this->pdfEngine->SetKeywords($keywords);
441 if (!empty($this->pdfCreator)) {
442 $this->pdfEngine->SetCreator($this->pdfCreator);
444 if (!empty($this->fontFamily)) {
445 $this->pdfEngine->SetFont($this->fontFamily, $this->fontStyle, $this->fontSize);
447 if (!empty($this->monoFontFamily)) {
448 $this->pdfEngine->SetDefaultMonospacedFont($this->monoFontFamily);
450 if (!empty($this->leftMargin)) {
451 $this->pdfEngine->SetMargins($this->leftMargin, $this->topMargin, $this->rightMargin);
453 if (empty($this->bottomMargin)) {
454 $this->bottomMargin = PDF_MARGIN_BOTTOM;
456 $this->pdfEngine->SetAutoPageBreak(
true, $this->bottomMargin);
469 $text= html_entity_decode(
$text, ENT_QUOTES,
"UTF-8");
470 $text= preg_replace_callback(
473 return utf8_encode(chr($m[1]));
477 $text= preg_replace_callback(
478 '/&#x([a-f0-9]+);/mi',
480 return utf8_encode(chr(
'0x'.$m[1]));
setSubject($response, $pdfSubject)
setPageOrientation($response, $pageOrientation)
if(!$xoops->security() ->validateToken(@$_POST['token'], false)) $html
setDefaultMonospacedFont($response, $monoFontFamily)
addHtml($response, $html)
setBaseUnit($response, $unit)
outputPdfInline($response, $name)
setPageSize($response, $pageSize)
setTitle($response, $pdfTitle)
setMargins($response, $leftMargin, $topMargin, $rightMargin, $bottomMargin)
setFromConfigs($name, $property, $default)
setAuthor($response, $pdfAuthor)
if($xoops->isUser()&&$isAdmin) $response
setKeywords($response, $pdfKeywords)
outputPdfDownload($response, $name)
setBaseFont($response, $fontFamily, $fontStyle= '', $fontSize=null)