#1342 #1343 #1345 #1346 #1349 git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3340 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
27d2713283
commit
652eeb16cb
27 changed files with 994 additions and 204 deletions
53
trunk/src/AppBundle/Pdf.php
Normal file
53
trunk/src/AppBundle/Pdf.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle;
|
||||
|
||||
use TCPDF;
|
||||
|
||||
class Pdf extends TCPDF
|
||||
{
|
||||
private $webDir;
|
||||
private $assetManager;
|
||||
|
||||
function __construct($rootDir, $assetManager)
|
||||
{
|
||||
parent::__construct('P', 'mm', 'A4', true, 'UTF-8', false, false);//($orientation, $unit, $format, $unicode, $encoding, $diskcache, $pdfa);//('P', 'mm', 'A4', true, 'UTF-8', false, false);
|
||||
$this->webDir = realpath($rootDir . '/../web');
|
||||
$this->assetManager = $assetManager;
|
||||
}
|
||||
|
||||
private function getFileName($file)
|
||||
{
|
||||
$assetPath = $this->assetManager->get($file)->getTargetPath();
|
||||
$fileNameParts = explode('/', $assetPath);
|
||||
$lastPartIndex = count($fileNameParts) - 1;
|
||||
$fileName = $fileNameParts[$lastPartIndex];
|
||||
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
public function Header()
|
||||
{
|
||||
$backgroundDir = $this->webDir.'\bundles\app\images\header-bg.png';
|
||||
$logoDir = $this->webDir.'\assetic\\'.$this->getFileName('headerLogo');
|
||||
|
||||
$this->Image($backgroundDir, 0, 0, 210, 0, '', '', '', false, 300, 'C');
|
||||
$this->Image($logoDir, 0, 15, 90, 0, '', '', '', false, 300, 'C');
|
||||
}
|
||||
|
||||
public function Footer()
|
||||
{
|
||||
|
||||
$footerDir = $this->webDir.'\assetic\\'.$this->getFileName('footerText');
|
||||
|
||||
$this->ImageSVG($footerDir, 0, 228, 210, '');
|
||||
|
||||
$this->SetY(-58);
|
||||
$this->SetX(-30);
|
||||
$this->SetFont('helvetica', '', 10);
|
||||
$this->Cell(0, 14, 'Seite '.$this->getAliasNumPage().' von '.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file Pdf.php */
|
||||
/* Location: ./application/libraries/Pdf.php */
|
||||
Loading…
Add table
Add a link
Reference in a new issue