Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/fooman/pdfcore-m2/src/Model/Tcpdf/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/fooman/pdfcore-m2/src/Model/Tcpdf/Pdf.php
<?php
/**
 * @copyright Copyright (c) 2015 Fooman Limited (http://www.fooman.co.nz)
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Fooman\PdfCore\Model\Tcpdf;

class Pdf extends \TCPDF
{
    protected $footerContent;

    protected $headerInstructions = [];

    protected $backgroundImage;

    protected $backgroundImageFirstPageOnly;

    protected $pageNumberOffSet;

    protected $fontData = ['family' => 'helvetica', 'size' => 12];

    /**
     * @param \Fooman\PdfCore\Helper\Page $pageHelper
     *
     */
    public function __construct(
        \Fooman\PdfCore\Helper\Page $pageHelper
    ) {
        parent::__construct(
            $pageHelper->getOrientation(),
            'mm',
            $pageHelper->getSize(),
            true,
            'UTF-8',
            false,
            false
        );
        $this->tcpdflink = false;
    }

    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps -- Tcpdf library does not conform to PSR1
    public function Header()
    {
        if ($this->backgroundImage && $this->isBackgroundFirstPageOnly()) {
            $this->SetAutoPageBreak(false);
            $this->Image(
                $this->backgroundImage,
                0,
                0,
                $this->getPageWidth(),
                $this->getPageHeight(),
                $type = '',
                $link = '',
                $align = '',
                $resize = false,
                $dpi = 300,
                $palign = '',
                $ismask = false,
                $imgmask = false,
                $border = 0,
                $fitbox = true,
                $hidden = false
            );
            $this->SetAutoPageBreak(true, $this->getFooterMargin() + 10);
        }
        if (!empty($this->headerInstructions)) {
            foreach ($this->headerInstructions as $function => $arguments) {
                $this->{$function}(...$arguments);
            }
        }

        // Line break
        $this->Ln();
    }

    public function setHeaderInstructions($operations)
    {
        $this->headerInstructions = $operations;
    }

    public function setBackgroundImage($image)
    {
        $this->backgroundImage = $image;
    }

    public function setPageNumberOffSet($number)
    {
        $this->pageNumberOffSet = $number;
    }

    public function setBackgroundImageFirstPageOnly($config)
    {
        $this->backgroundImageFirstPageOnly = $config;
    }

    // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps -- Tcpdf library does not conform to PSR1
    public function Footer()
    {
        $this->SetFont($this->fontData['family'], '', $this->fontData['size']);
        $this->SetAutoPageBreak(false);
        $this->writeHTML($this->footerContent);
        if ($this->pageNumberOffSet) {
            $this->Cell(0, 0, ($this->getPage() + $this->pageNumberOffSet), 0, 0, 'C');
        }
        $this->SetAutoPageBreak(true, $this->getFooterMargin() + 10);
    }

    public function setFooterContent($html, $fontData = [])
    {
        $this->footerContent = $html;
        if (!empty($fontData)) {
            $this->fontData = $fontData;
        }
    }

    /**
     * override parent function to change default style
     *
     * @param        $code
     * @param        $type
     * @param string $x
     * @param string $y
     * @param string $w
     * @param string $h
     * @param float  $xres
     * @param array  $userStyle
     * @param string $align
     *
     * @internal param string $style
     */
    public function write1DBarcode(
        $code,
        $type,
        $x = '',
        $y = '',
        $w = '',
        $h = '',
        $xres = 0.4,
        $userStyle = [],
        $align = 'T'
    ) {
        $this->SetX($this->GetX() + 4);
        $defaultStyle = [
            'position'    => 'S',
            'border'      => false,
            'padding'     => 1,
            'fgcolor'     => [0, 0, 0],
            'bgcolor'     => false,
            'text'        => true,
            'font'        => 'helvetica',
            'fontsize'    => 8,
            'stretchtext' => 4
        ];
        $style = $userStyle + $defaultStyle;
        parent::write1DBarcode($code, $type, $x, $y, $w, $h, $xres, $style, $align);
    }

    public function isBackgroundFirstPageOnly()
    {
        return !$this->backgroundImageFirstPageOnly
            || ($this->backgroundImageFirstPageOnly && isset($this->newpagegroup[$this->page]));
    }
}

Spamworldpro Mini