\n"; $htmlOut .= " \n"; $htmlOut .= " " . $pageTitel . "\n"; $htmlOut .= " \n"; $htmlOut .= " \n"; $htmlOut .= $htmlSnip; $htmlOut .= " \n"; $htmlOut .= "\n"; return $htmlOut; } // Generate unique filename $categoryName = "XX"; if ($category == "300") : $categoryName = "AP"; elseif ($category == "305") : $categoryName = "FB"; endif; $f_secretFileName = $categoryName . "_" . $objId; if ($commNo != "") : $f_secretFileName .= "_" . $commNo; endif; // Source filename $fileExtensionSource = "html"; $fileName = $pdfPathRelative . $f_secretFileName . "." . $fileExtensionSource; // Target filename $fileExtensionTarget = $fileTargetType; $fileNameTarget = $pdfPathRelative . $f_secretFileName . "." . $fileExtensionTarget; // Generate HTML WITH ABSOLUTE path for creating PDF, etc. $htmlOut = generateOutputHTML($outputMetaFieldsHtmlPHP); // Remove old file(s) [Müsste zum Aufräumen noch erweitert werden, so dass automatisch alle Dateien die alter sind als inkl. gestern gelöscht werden !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!] /* foreach (glob($fileName) as $fileNameToBoRemoved) { if (file_exists($fileNameToBoRemoved)) : unlink($fileNameToBoRemoved); endif; } */ // **** Convert HTML file **** // Check configuration for output if (isset($sendToClientInlineDisplay) && $sendToClientInlineDisplay == "1") : $sendToClientInlineDisplay = true; else : $sendToClientInlineDisplay = false; endif; if (isset($sendToClientFileDownload) && $sendToClientFileDownload == "1") : $sendToClientFileDownload = true; else : $sendToClientFileDownload = false; endif; if (!isset($fileTargetType) || $fileTargetType == "") : $fileTargetType = "pdf"; endif; $pdfGlobalOptions = ""; $pdfPageOptions = ""; if ($pdfPageSize == "DEFAULT") : $pdfPageSize = ""; endif; if ($pdfPageSize != "") : if ($pdfPageSize == "label60x40") : $pdfGlobalOptions = array('page-height' => '40mm', 'page-width' => '60mm', 'margin-bottom' => '1mm', 'margin-left' => '3mm', 'margin-right' => '1mm', 'margin-top' => '1mm'); $pdfPageOptions = array('disable-smart-shrinking'); else : $pdfGlobalOptions = array('page-size' => $pdfPageSize); endif; endif; if ($pdfGlobalOptions == "" || !is_array($pdfGlobalOptions)) : $pdf = new WkHtmlToPdf; else : $pdf = new WkHtmlToPdf($pdfGlobalOptions); endif; $pdf->addPage($htmlOut, $pdfPageOptions); // Add a HTML file, a HTML string or a page from a URL ["$pdf->addPage($fileName);" OR "$pdf->addPage('http://assecutor.de');" possible] // $pdf->addCover('mycover.html'); // Add a cover (same sources as above are possible) // $pdf->addToc(); // Add a Table of contents // Save the PDF if (!$pdf->saveAs($fileNameTarget)) : throw new Exception('Could not create PDF: '.$pdf->getError()); endif; // Send to client for inline display if ($sendToClientInlineDisplay == "1") : $pdf->send(); endif; // Send to client for file download if ($sendToClientFileDownload == "1") : $pdf->send($fileNameTarget); endif; // echo $htmlOut; ?>