Esempio n. 1
0
 /**
  * @return bool
  */
 public function PostPdfFromHtml()
 {
     $oAccount = $this->getAccountFromParam();
     if ($oAccount) {
         $sSubject = (string) $this->getParamValue('Subject', '');
         $sHtml = (string) $this->getParamValue('Html', '');
         include_once PSEVEN_APP_ROOT_PATH . 'libraries/other/CssToInlineStyles.php';
         $oCssToInlineStyles = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($sHtml);
         $oCssToInlineStyles->setEncoding('utf-8');
         $oCssToInlineStyles->setUseInlineStylesBlock(true);
         $this->RawOutputHeaders(true, 'application/pdf', $sSubject . '.pdf');
         include_once PSEVEN_APP_ROOT_PATH . 'libraries/dompdf/dompdf_config.inc.php';
         $oDomPdf = new \DOMPDF();
         $oDomPdf->load_html('<html><head></head><body>' . \MailSo\Base\HtmlUtils::ClearHtmlSimple($oCssToInlineStyles->convert(), true, true) . '</body></html>');
         $oDomPdf->render();
         $oDomPdf->stream($sSubject . '.pdf', array('Attachment' => false));
         return true;
     }
     return false;
 }