mardi 23 août 2016

tcpdf with laravel 5

i want to save the output pdf file to public folder my method is

public function qrSVG()
{
    $qrCodes = ['4659284fff','465928447','465928447','613271980','484016586','aaaaabbbbbccccc'];
    $id = ['201596400-1','201596400-2','201596400-3','831070646','493130428','aaaaabbbb'];


    PDF::SetTitle('qrcodes\test');

    $i=0;
    foreach(array_chunk($qrCodes, 2) as $qrCodee)
    {
        PDF::AddPage();
        $m = 55;
        $n = 30;
        foreach($qrCodee as $qr)
        {
            QrCode::size(400);
            QrCode::margin(3);
            QrCode::errorCorrection('H');
            QrCode::encoding('UTF-8');
            QrCode::backgroundColor(255,255,255);
            QrCode::color(0,0,0);
            QrCode::imageTitle($id[$i]);  
            $svg = QrCode::generate($qr);
            PDF::ImageSVG('@'.$svg, $x=$m, $y=$n, $w='100', $h='100', $link='', $align='', $palign='', $border=1, $fitonpage=false);
            $i++;
            $n = 150;
        }    
    }    
    ob_clean();
    PDF::Output('qrcodes\test.pdf');}

this code generate and open the file put don't save it when i replace the last line in my code with PDF::Output('qrcodes\test.pdf', 'F'); when i put any option with PDF::Output there is an error with F and D options the error when use F is ErrorException in tcpdf_static.php line 2440: fopen(): remote host file access not supported, http://fileqrcodes\test.pdf and when i replace the last line with

PDF::Output($_SERVER['DOCUMENT_ROOT'] . 'qrcodes\test.pdf', 'F');

the error is ErrorException in tcpdf.php line 2793: Undefined property: Elibyy\TCPDF\Pdf::$h



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire