Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 9 |
| PdfHelper | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
6.00 | |
0.00% |
0 / 9 |
| setHeader | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
|||
| encode | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace common\helpers; | |
| use HaruDoc; | |
| use HaruPage; | |
| use Yii; | |
| class PdfHelper extends \yii\base\BaseObject | |
| { | |
| public static function setHeader($documentName = 'doc.pdf') | |
| { | |
| header('Content-Type: application/pdf'); | |
| header('Content-Disposition: inline; filename="' . $documentName . '"'); | |
| header('Cache-Control: private, max-age=0, must-revalidate'); | |
| header('Pragma: public'); | |
| } | |
| public static function encode($text, $sourceEncoding = 'UTF-8') | |
| { | |
| return iconv($sourceEncoding, Yii::$app->params['pdf.encoding'].Yii::$app->params['pdf.encodingMode'], $text); | |
| } | |
| } |