如何使用TPDF更改prestashop中pdf的大小

时间:2016-07-05 10:49:17

标签: pdf prestashop prestashop-1.6 prestashop-1.5

我希望纸张的尺寸增加到A3 OR OR C4(宽度增加) 我在下面试过,但是无论如何都没有改变生成的pdf的大小?

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();
}

1 个答案:

答案 0 :(得分:0)

在override / classes / pdf中创建一个PDFGenerator.php文件。

in PDFGenerator.php insert:

<?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);
    }
}

删除缓存/ class_index.php