HtmlToPdf($this->GenerateHTML()); file_put_contents($FileName, $PdfData); } function HtmlToPdf(string $HtmlCode): string { $Encoding = new Encoding(); if ($this->Checked == false) { if (CommandExist('htmldoc')) { $this->Checked = true; } else throw new Exception('htmldoc is not installed.'); } $Parameters = '--no-numbered --footer . --webpage --no-embedfonts --charset '.$this->Charset.' -t '.$this->OutputFormat; if ($this->FontSize > 0) $Parameters .= ' --fontsize '.$this->FontSize; if ($this->BorderLeft != '') $Parameters .= ' --left '.$this->BorderLeft; if ($this->BorderTop != '') $Parameters .= ' --top '.$this->BorderTop; if ($this->BorderRight != '') $Parameters .= ' --right '.$this->BorderRight; if ($this->BorderBottom != '') $Parameters .= ' --bottom '.$this->BorderBottom; $Output = shell_exec('echo "'.addslashes($Encoding->FromUTF8($HtmlCode)). '"|htmldoc '.$Parameters.' -'); return $Output; } }