Current path: home/webdevt/cryptoimpot.fr/module/Application/src/Service/
?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/src
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace Application\Service;
/**
* Description of TCPDFBrouillon
*
* @author jimmy
*/
class TCPDFBrouillon extends \TCPDF {
public $titlePDFCustom;
public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $container) {
//var_dump($container); exit;
$this->container = $container;
parent::__construct(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
}
public function Header() {
// Logo
$this->SetY(-35);
// $this->SetY(0);
// var_dump($this->container);
$config = $this->container->get('config');
//var_dump($config['path-app']); exit;
// var_dump(K_PATH_IMAGES); exit;
//$image_file = $config['path-app'] . '/vendor/tecnickcom/tcpdf/examples/images/logo_example.jpg';
//$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
$svg = $config['path-app'] . '/public/img/logo.svg';
$doc = new \DOMDocument;
$doc->load($svg);
$xpath = new \DOMXPath($doc);
$xpath->registerNamespace('svg', 'http://www.w3.org/2000/svg');
$path_list = $xpath->query('svg:path');
$circle_list = $xpath->query('svg:circle');
foreach ($path_list as $path) {
$path->setAttribute('fill', '#000000');
}
foreach ($circle_list as $circle) {
$circle->setAttribute('fill', '#000000');
}
$svgString = $doc->saveXML();
$image_file = $config['path-app'] . '/public/img/logo.svg';
//$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
//$this->ImageSVG($image_file, $x=5, $y=5, $w=30, $h=30, $link='', $align='', $palign='', $border=0, $fitonpage=false);
$this->ImageSVG('@' . $svgString, $x=5, $y=11, $w=4, $h=4, $link='', $align='', $palign='', $border=0, $fitonpage=false);
$this->SetY(10);
$this->SetX(10);
$this->SetFont('helvetica', 'B', 12);
$this->Cell($w, $h=0, $txt='Ledgio', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M');
// $this->SetY(95);
// $this->SetY(0);
// Set font
$this->SetY(10);
$this->SetX(30);
// Set font
$this->SetFont('helvetica', 'B', 12);
//$this->SetFont('helvetica', 'B', 15);
// Title
$this->Cell($w, $h=0, $txt=$this->titlePDFCustom, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M');
//$this->Cell(30, 15, $this->titlePDFCustom, 0, false, 'C', 0, '', 0, false, 'M', 'M');
//$this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
// filigrane brouillon
// $image_file2 = $config['path-app'] . '/public/img/pdf/filigrane-brouillon.png';
// $this->Image($image_file2, 0, 0, $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = 2, $dpi = 300, $palign = 'C', $ismask = false, $imgmask = false, $border = 0, $fitbox = 'CM', $hidden = false, $fitonpage = true, $alt = false, $altimgs = array());
$this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$image_file = $config['path-app'] . '/public/img/pdf/filigrane-brouillon.png';
$this->startLayer('layer', true, true, false);
$this->SetY(30);
$this->Image($image_file, '', '', '', '', '', '', 'C', true, 300, 'C', false, false, 0, '', false, false);
// Get the current page break margin
//$bMargin = $this->getBreakMargin();
// Get current auto-page-break mode
//$auto_page_break = $this->AutoPageBreak;
// Disable auto-page-break
//$this->SetAutoPageBreak(false, 0);
// Restore the auto-page-break status
//$this->SetAutoPageBreak($auto_page_break, $bMargin);
// Set the starting point for the page content
$this->setPageMark();
}
public function Footer() {
// $config = $this->container->get('config');
// $image_file = $config['path-app'] . '/public/img/pdf/filigrane-brouillon.png';
// $this->startLayer('layer', true, true, true);
// $this->Image($image_file, '', '', '', '', '', '', 'C', true, 300, 'C', false, false, 0, '', false, false);
// Page footer
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 8);
// Page number
$this->Cell(0, 10, 'Page ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
$this->SetHeaderMargin(PDF_MARGIN_HEADER);
}
}