PHP code example of 6amtech / laravel-electron-printing
1. Go to this page and download the library: Download 6amtech/laravel-electron-printing 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/ */
6amtech / laravel-electron-printing example snippets
use LaravelElectronPrinting\Facades\ElectronPrint;
ElectronPrint::printView('receipt', ['order' => $order], null, 'thermal_80mm');
use LaravelElectronPrinting\Facades\ElectronPrint;
// Print HTML
ElectronPrint::printHtml('<h1>Hello World</h1>');
// Print Blade view
ElectronPrint::printView('receipt', ['order' => $order]);
// Print to specific printer
ElectronPrint::printView('receipt', $data, 'EPSON TM-T88V');
// From file
ElectronPrint::printPdfFile(storage_path('app/invoice.pdf'));
// From URL
ElectronPrint::printPdfUrl('https://example.com/invoice.pdf');
// From Base64
ElectronPrint::printPdfBase64($base64String);
// With profile
ElectronPrint::printPdfFile(storage_path('app/invoice.pdf'), null, 'a4');