PHP code example of torgodly / html2media

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

    

torgodly / html2media example snippets


Html2MediaAction::make('print')
    ->filename('my-custom-document')

Html2MediaAction::make('print')
    ->pagebreak('section', ['css', 'legacy'])

Html2MediaAction::make('print')
    ->orientation('landscape')

Html2MediaAction::make('print')
    ->format('letter', 'in')

Html2MediaAction::make('print')
    ->enableLinks()

Html2MediaAction::make('print')
    ->scale(2)

Html2MediaAction::make('print')
    ->print(true)

Html2MediaAction::make('print')
    ->preview()

Html2MediaAction::make('print')
    ->savePdf()

Html2MediaAction::make('print')
    ->

Html2MediaAction::make('print')
    ->content(fn($record) => view('invoice', ['record' => $record]))

Html2MediaAction::make('print')
    ->scale(2)
    ->print() // Enable print option
    ->preview() // Enable preview option
    ->filename('invoice') // Custom file name
    ->savePdf() // Enable save as PDF option
    ->]) // Set custom margins
    ->content(fn($record) => view('invoice', ['record' => $record])) // Set content

use Torgodly\Html2Media\Actions\Html2MediaAction;
use Torgodly\Html2Media\Tables\Actions\Html2MediaAction;

Html2MediaAction::make('print')
    ->content(fn($record) => view('invoice', ['record' => $record]))

Html2MediaAction::make('print')
    ->savePdf()
    ->content(fn($record) => view('invoice', ['record' => $record]))