forked from sampart/WhiteOctoberTCPDFBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WhiteOctoberTCPDFBundle.php
45 lines (39 loc) · 1.33 KB
/
WhiteOctoberTCPDFBundle.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
namespace WhiteOctober\TCPDFBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class WhiteOctoberTCPDFBundle extends Bundle
{
/**
* Ran on bundle boot, our TCPDF configuration constants
* get defined here if required
*/
public function boot()
{
// Define our TCPDF variables
$config = $this->container->getParameter('white_october_tcpdf.tcpdf');
// TCPDF needs some constants defining if our configuration
// determines we should do so (default true)
// Set tcpdf.k_tcpdf_external_config to false to use the TCPDF
// core defaults
if ($config['k_tcpdf_external_config'])
{
foreach ($config as $k => $v)
{
$constKey = strtoupper($k);
// All K_ constants are required
if (preg_match("/^k_/i", $k))
{
if (!defined($constKey))
{
define($constKey, $this->container->getParameterBag()->resolveValue($v));
}
}
// and one special value which TCPDF will use if present
if (strtolower($k) == "pdf_font_name_main" && !defined($constKey))
{
define($constKey, $v);
}
}
}
}
}