PHP code example of atik / atik-pdf

1. Go to this page and download the library: Download atik/atik-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/ */

    

atik / atik-pdf example snippets


use Atik\Pdf\Facades\AtikPdf;

return AtikPdf::view('invoices.standard', ['invoice' => $data])
    ->download('invoice_001.pdf');

$columns = ['ID', 'Name', 'Amount'];
$rows = [
    [1, 'Atik', '500'],
    // ... 10,000 more rows
];

return AtikPdf::auto($rows, $columns, 'Monthly Report')
    ->stream();

AtikPdf::async($massiveRowArray, $columns, 'Massive Dataset')
    ->webhook('https://myapp.com/api/webhooks/pdf-ready')
    ->queue('reports/massive_report_august.pdf');

return response()->json(['message' => 'PDF is generating in the background!']);

$columns = ['ID', 'Product', 'Price', 'Stock'];
$rows = [
    [1, 'Widget A', 19.99, 100],
    [2, 'Widget B', 29.99, 50],
];

return AtikPdf::excel()
    ->table($rows, $columns, 'Inventory Report')
    ->download('inventory');

return AtikPdf::csv()
    ->table($rows, $columns)
    ->stream('export');

AtikPdf::excel()
    ->async($rows, $columns, 'Large Dataset')
    ->queue('exports/dataset.xlsx');
bash
php artisan vendor:publish --tag=atik-pdf-config
php artisan vendor:publish --tag=atik-pdf-python-service