jeudi 29 juillet 2021

laravel-snappy library allways generate pdf in letter format

I´m traying to generate pdf in my application web with laravel-snappy, and always generate pdf in format landscape but i´m setting other configuration:

public function handle()
    {
        $pdfName = "precontrato.pdf";
        $path    = 'app/contratos/'.$this->precontrato->serie.'-'.$this->precontrato->contador.'/'.$pdfName;
        $pdfPath  = storage_path($path);

        $pdf = PDF::loadView('pdf.precontrato', ['precontrato' => $this->precontrato])
                            ->setPaper('a4')
                            ->setOrientation('portrait')
                            //->setOption('zoom', 1.2)
                            ->setOption('footer-center', 'EDICIONES GRUPO DELUXE 2013 S.L.U está Inscripta en el Registro Mercantil de Granada al Tomo 1548 Folio 42 Hoja GR46323 Inscrip. 1ª')
                            ->setOption('footer-font-size', 5);

        $pdfCreado = $pdf->save($pdfPath, true);

    }

this is my job i´m need a4 format to my pdf but i don´t know, always this library generated me, my pdf in letter format:

this is my snappy.php

'pdf' => [
        'enabled' => true,
        'binary'  => '"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf"',
        'timeout' => false,
        'options' => array(
            'encoding' => 'UTF-8',
            'viewport-size' => '1024x768',
            //'margin-top' => 0,
            //'margin-bottom' => 7,
            //'margin-left' => 20,
            //'margin-right' => 20,
            'footer-right' => "Página [page] de [toPage]",
            'footer-font-size' => 3
        )
    ],

    'image' => [
        'enabled' => true,
        'binary'  => '/usr/local/bin/wkhtmltoimage',
        'timeout' => false,
        'options' => [],
        'env'     => [],
    ],

i don´t know where i can to show to change this...

Thanks for help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire