X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FPDF%2FUtils.php;h=0e9f00c6d8d14868531c9f73075bffec6b8431b2;hb=79a18c21d066b39f244726e5a6052176a763259b;hp=6cc6040c43265c73596aebccab353efbf634643e;hpb=f3b0cd839c6b1e5ad33ae1b1d053da225c2c9e9f;p=civicrm-core.git diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 6cc6040c43..0e9f00c6d8 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -1,7 +1,7 @@ Open(); - if (is_readable($stationery_path)){ - $pdf->SetStationery( $stationery_path ); + if (is_readable($stationery_path)) { + $pdf->SetStationery($stationery_path); } $pdf->SetAuthor(''); $pdf->SetKeywords('CiviCRM.org'); - $pdf->setPageUnit( $margins[0] ) ; - $pdf->SetMargins($margins[4], $margins[1], $margins[2], true); + $pdf->setPageUnit($margins[0]); + $pdf->SetMargins($margins[4], $margins[1], $margins[2], TRUE); $pdf->setJPEGQuality('100'); - $pdf->SetAutoPageBreak(true, $margins[3]); + $pdf->SetAutoPageBreak(TRUE, $margins[3]); $pdf->AddPage(); - $ln = true ; - $fill = false ; - $reset_parm = false; - $cell = false; - $align = '' ; + $ln = TRUE; + $fill = FALSE; + $reset_parm = FALSE; + $cell = FALSE; + $align = ''; // output the HTML content $pdf->writeHTML($html, $ln, $fill, $reset_parm, $cell, $align); @@ -164,7 +164,7 @@ class CRM_Utils_PDF_Utils { // close and output the PDF $pdf->Close(); - $pdf_file = 'CiviLetter'.'.pdf'; + $pdf_file = 'CiviLetter' . '.pdf'; $pdf->Output($pdf_file, 'D'); CRM_Utils_System::civiExit(1); } @@ -178,7 +178,7 @@ class CRM_Utils_PDF_Utils { * * @return string */ - static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) { + public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) { require_once 'packages/dompdf/dompdf_config.inc.php'; spl_autoload_register('DOMPDF_autoload'); $dompdf = new DOMPDF(); @@ -202,7 +202,7 @@ class CRM_Utils_PDF_Utils { * @param $output * @param string $fileName */ - static function _html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName) { + public static function _html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName) { require_once 'packages/snappy/src/autoload.php'; $config = CRM_Core_Config::singleton(); $snappy = new Knp\Snappy\Pdf($config->wkhtmltopdfPath); @@ -224,10 +224,9 @@ class CRM_Utils_PDF_Utils { } } - /* - * convert value from one metric to another - */ /** + * convert value from one metric to another + * * @param $value * @param $from * @param $to @@ -235,7 +234,7 @@ class CRM_Utils_PDF_Utils { * * @return float|int */ - static function convertMetric($value, $from, $to, $precision = NULL) { + public static function convertMetric($value, $from, $to, $precision = NULL) { switch ($from . $to) { case 'incm': $value *= 2.54; @@ -302,15 +301,16 @@ class CRM_Utils_PDF_Utils { * @param string $author * @param string $title */ - static function &pdflib($fileName, + public static function &pdflib( + $fileName, $searchPath, &$values, $numPages = 1, - $echo = TRUE, - $output = 'College_Match_App', - $creator = 'CiviCRM', - $author = 'http://www.civicrm.org/', - $title = '2006 College Match Scholarship Application' + $echo = TRUE, + $output = 'College_Match_App', + $creator = 'CiviCRM', + $author = 'http://www.civicrm.org/', + $title = '2006 College Match Scholarship Application' ) { try { $pdf = new PDFlib(); @@ -355,7 +355,6 @@ class CRM_Utils_PDF_Utils { $pdf->fit_pdi_page($page, 0, 0, 'adjustpage'); - $status = array(); /* Fill all text blocks with dynamic data */ @@ -396,15 +395,15 @@ class CRM_Utils_PDF_Utils { return $buf; } } - catch(PDFlibException$excp) { + catch (PDFlibException$excp) { CRM_Core_Error::statusBounce('PDFlib Error: Exception' . "[" . $excp->get_errnum() . "] " . $excp->get_apiname() . ": " . $excp->get_errmsg() ); } - catch(Exception$excp) { + catch (Exception$excp) { CRM_Core_Error::statusBounce("PDFlib Error: " . $excp->get_errmsg()); } } -} +}