-
-
Notifications
You must be signed in to change notification settings - Fork 126
/
ExportWriterPdf.php
45 lines (38 loc) · 963 Bytes
/
ExportWriterPdf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2023
* @package yii2-export
* @version 1.4.3
*/
namespace kartik\export;
use kartik\mpdf\Pdf;
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
/**
* Krajee custom PDF Writer library based on MPdf
*
* @author Kartik Visweswaran <kartikv2@gmail.com>
* @since 1.0
*/
class ExportWriterPdf extends Mpdf
{
/**
* @var string the exported output file name. Defaults to 'grid-export';
*/
public $filename = '';
/**
* @var array kartik\mpdf\Pdf component configuration settings
*/
public $pdfConfig = [];
/**
* @inheritdoc
*/
protected function createExternalWriterInstance($config = [])
{
if (isset($config['tempDir'])) {
unset($config['tempDir']);
}
$config = array_replace_recursive($config, $this->pdfConfig);
$pdf = new Pdf($config);
return $pdf->getApi();
}
}