19 declare(strict_types=1);
35 $this->log = $DIC->logger()->root();
47 $gui->addConfigForm($form);
54 $gui->populateForm($form, $this->config);
60 return $gui->validateForm($form);
66 return $gui->getConfigFromForm($form);
80 file_put_contents($html_file, implode(
'', $pages));
99 protected function runCommandLine(
string $a_path_to_file,
string $a_target, $config): void
103 $args = $wkConfig->getCommandLineConfig() .
' ' . $a_path_to_file .
' ' . $temp_file . $this->
redirectLog();
107 $this->log->debug(
'ilWebkitHtmlToPdfTransformer command line config: ' . $args);
109 unlink($a_path_to_file);
125 $originalFile = file_get_contents($a_path_to_file) . $backupStyle;
126 file_put_contents($a_path_to_file, $originalFile);
136 $style =
'<style>div.questionPrintview img.small {height: 20px; width: 20px;}</style>';
137 $originalFile = file_get_contents($a_path_to_file) . $style;
138 file_put_contents($a_path_to_file, $originalFile);
151 foreach ($return_value as
$key => $value) {
152 $this->log->debug(
'ilWebkitHtmlToPdfTransformer return value line ' .
$key .
' : ' . $value);
154 if (file_exists($temp_file)) {
155 $this->log->debug(
'ilWebkitHtmlToPdfTransformer file exists: ' . $temp_file .
' file size is :' . filesize($temp_file) .
' bytes, will be renamed to ' . $a_target);
156 rename($temp_file, $a_target);
158 $this->log->info(
'ilWebkitHtmlToPdfTransformer error: ' . print_r($return_value,
true));
appendDefaultFontStyle(string $a_path_to_file, ilWkhtmlToPdfConfig $config)
fixIconSizeForPatchedQt(string $a_path_to_file)
Fix for an issue of WkhtmlToPdf with patched QT Without a fixed width the icons would be distorted an...
checkReturnValueFromCommandLine(array $return_value, string $temp_file, string $a_target)
setLanguage(ilLanguage $lng)
validateConfigInForm(ilPropertyFormGUI $form, string $service, string $purpose)
getOverwriteDefaultFont(bool $renderStyle=false)
getConfigFromForm(ilPropertyFormGUI $form, string $service, string $purpose)
generatePDF(string $service, string $purpose, $config, ilPDFGenerationJob $job)
static execQuoted(string $cmd, ?string $args=null)
runCommandLine(string $a_path_to_file, string $a_target, $config)
getDefaultConfig(string $service, string $purpose)
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
getTempFileName(string $file_type)
static getInstance()
Singleton: get instance for use in ILIAS requests with a config loaded from the settings.
createPDFFileFromHTMLFile(string $a_path_to_file, $config, ilPDFGenerationJob $job)
populateConfigElementsInForm(ilPropertyFormGUI $form, string $service, string $purpose, $config)
ilWkhtmlToPdfConfig $config
prepareGenerationRequest(string $service, string $purpose)
Prepare the content processing at the beginning of a PDF generation request Should be used to initial...
addConfigElementsToForm(ilPropertyFormGUI $form, string $service, string $purpose)
__construct(bool $phpunit=false)
const RENDER_SVG_AS_XML_EMBED