如何使用TPDF更改prestashop中pdf的大小
我希望纸张的尺寸增加到A3或C4(宽度增加) 我在下面尝试过,但是没有任何改变,不管怎样,是否可以改变生成的pdf的大小如何使用TPDF更改prestashop中pdf的大小,pdf,prestashop,prestashop-1.6,prestashop-1.5,Pdf,Prestashop,Prestashop 1.6,Prestashop 1.5,我希望纸张的尺寸增加到A3或C4(宽度增加) 我在下面尝试过,但是没有任何改变,不管怎样,是否可以改变生成的pdf的大小 public function generatePDF($object, $template) { switch($template) { case PDF::TEMPLATE_ETICKET: $format = 'C3'; // Replace with your desired size brea
public function generatePDF($object, $template)
{
switch($template) {
case PDF::TEMPLATE_ETICKET:
$format = 'C3'; // Replace with your desired size
break;
default:
$format = 'A4'; // Replace with normal size
}
$pdf = new PDF($object, $template, Context::getContext()->smarty,'P', $format);
//d($pdf);
$pdf->render();
}
在override/classes/pdf中创建一个文件PDFGenerator.php 在PDFGenerator.php中插入:
<?php
class PDFGenerator extends PDFGeneratorCore
{
public function __construct($use_cache = false, $orientation = 'P')
{
parent::__construct($orientation, 'mm', 'A3', true, 'UTF-8', $use_cache, false); /*Replace A3 with the size you prefer */
$this->setRTL(Context::getContext()->language->is_rtl);
}
}