PHP code example of alifahmmed / pdfbuilder

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

    

alifahmmed / pdfbuilder example snippets

bash
php artisan vendor:publish --provider="AlifAhmmed\PdfBuilder\PdfBuilderServiceProvider" --tag=config
php artisan vendor:publish --provider="AlifAhmmed\PdfBuilder\PdfBuilderServiceProvider" --tag=bin
bash
use PdfBuilder;

class PdfController extends Controller
{
    public function download()
    {
        $html = view('pdf.invoice', ['data' => $invoiceData])->render();
        $pdfContent = PdfBuilder::htmlToPdf($html);

        return response($pdfContent)
            ->header('Content-Type', 'application/pdf')
            ->header('Content-Disposition', 'attachment; filename="invoice.pdf"');
    }
}