tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.22k stars 1.52k forks source link

Undefined property: Elibyy\TCPDF\TCPDFHelper::$inxobj #623

Closed jrocchia-wengel closed 1 year ago

jrocchia-wengel commented 1 year ago

Hi everyone,

i have a form with 2 input file. i work with laravel 10. I put in each a picture JPG and submit the form.

My coworker only want PDF at the end so i use TCPDF to create a PDF and put in it the image.

    if(!empty($request->part_conv)){
        // upload th JPG on the server
        $tmp_image = Storage::disk('public')->putFile('folder',$request->part_conv);

        $tmp_tcpdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $tmp_tcpdf::AddPage('P', 'A4');
        $tmp_tcpdf::setJPEGQuality(75);
        $tmp_tcpdf::Image('storage/'.$tmp_image,0, 0, 297, 210, '', '', 'M', false, 300, 'C', false, false, 0, true, false, true, false, array());
        $tmp_tcpdf::Output(public_path('storage/pdf1.pdf'), 'F');
    }

    if(!empty($request->part_conv_bis)){
        // upload th JPG on the server
        $tmp_image = Storage::disk('public')->putFile('folder',$request->part_conv_bis);

        $tmp_tcpdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $tmp_tcpdf::AddPage('P', 'A4');
         $tmp_tcpdf::setJPEGQuality(75);
        $tmp_tcpdf::Image('storage/'.$tmp_image,0, 0, 297, 210, '', '', 'M', false, 300, 'C', false, false, 0, true, false, true, false, array());
        $tmp_tcpdf::Output(public_path('storage/pdf2.pdf'), 'F');
    }

if i put only one image and let the second input empty, i have no error.

if i put 2 images, I have Undefined property: Elibyy\TCPDF\TCPDFHelper::$inxobj

but as i know, this is an error for template on TCPDF, and i have no template in my code.

Does anybody already have this error ?

Thanks

jrocchia-wengel commented 1 year ago

the error point on $tmp_tcpdf::AddPage('P', 'A4'); for the second input

williamdes commented 1 year ago

You should probably close your issue here and open it there: https://github.com/elibyy/tcpdf-laravel