PHP code example of zaimealabs / pdf

1. Go to this page and download the library: Download zaimealabs/pdf library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zaimealabs / pdf example snippets


$invoice = \ZaimeaLabs\PDF\Invoice::make()
        ->addItem('Test Item', 10.25, 2, 1412)
        ->addItem('Test Item 2', 5, 2, 923)
        ->addItem('Test Item 3', 15.55, 5, 42)
        ->addItem('Test Item 4', 1.25, 1, 923)
        ->addItem('Test Item 5', 3.12, 1, 3142)
        ->addItem('Test Item 6', 5, 2, 923, 'https://dummyimage.com/64x64/000/fff')
        ->number(132) // can use our Metrics for generation, found in this package
        ->with_pagination(true)
        ->duplicate_header(true)
        ->due_date(Carbon::now()->addMonths(1))
        ->notes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
        ->customer([
            'name'      => 'Muster Mann',
            'id'        => '231',
            'phone'     => '+49 123 456 789',
            'location'  => 'Muster Str. 1',
            'zip'       => '10115',
            'city'      => 'Muster Stadt',
            'country'   => 'Germany',
        ])
        ->download('invoice')
        //or save it somewhere
        ->save('public/pdf/myinvoice132.pdf');

$report = \ZaimeaLabs\PDF\Report::make()
        ->addItem(now()->format('Y-m-d'), 'Custura Laurentiu', '06:00', '14:00', '00:30', '08:00', '')
            // $date, $name, $start = null, $end = null, $pause = null, $duration = null, $notes = null
        ->addChecks(true, true, false, true, true) 
            // $start, $end, $pause, $duration, $notes
        ->number(13) // can use our Metrics for generation, found in this package
        ->with_pagination(true)
        ->duplicate_header(true)
        ->due_date(Carbon::now()->addMonths(1))
        ->notes('Lrem ipsum dolor sit amet, consectetur adipiscing elit.')
        ->customer([
            'name'      => 'Muster Mann',
            'id'        => '231',
            'phone'     => '+49 123 456 789',
            'location'  => 'Muster Str. 1',
            'zip'       => '10115',
            'city'      => 'Muster Stadt',
            'country'   => 'Germany',
        ])
        ->download('report')
        //or save it somewhere
        ->save('public/pdf/myreport13.pdf');

->addItem(now()->format('Y-m-d'), 'Custura Laurentiu', '06:00', '14:00', '00:30', '08:00', ''
            [
                'type'          => 'worked',
                'approved'      => 'Yes',
            ]
        )

->addChecks(true, true, false, true, true,
                [
                    'type' => true,
                    'approved' => true,
                ]
            )

return response()->streamDownload( fn () => print($report->output()), 'myreport13.pdf');