PHP code example of soap / dompdf-thai

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

    

soap / dompdf-thai example snippets


<x-pdf-layout>
    <div class="py-12">
        <div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
            <div class="overflow-hidden bg-white shadow-sm dark:bg-gray-800 sm:rounded-lg">
                <div class="p-6 text-gray-900 dark:text-gray-100">
                    ทดสอบ This is a test for pdf
                </div>
            </div>
        </div>
    </div>
</x-pdf-layout>

  namespace App\Http\Controllers;

  use App\Models\Product;
  use App\Http\Requests\StoreProductRequest;
  use App\Http\Requests\UpdateProductRequest;
  use Barryvdh\DomPDF\Facade\Pdf;

  ....
    /**
     * Remove the specified resource from storage.
     */
    public function destroy(Product $product)
    {
        //
    }

    public function toPdf()
    {
        $pdf = Pdf::loadView('products.pdf'); //, ['products' => Product::all()]);

        return $pdf->stream();
    }
  
bash
php artisan vendor:publish --tag="dompdf-thai-assets"