PHP code example of lacv / pipo-scanner

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

    

lacv / pipo-scanner example snippets


use Lacv\PipoScanner\PipoScannerPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(PipoScannerPlugin::make());
}

use Lacv\PipoScanner\Forms\Components\ScannerField;

ScannerField::make('document_path')
    ->label('Document')
    ->columnSpanFull(),

ScannerField::make('document_path')
    ->label('Document')
    ->disk('public')
    ->directory('documents/contracts')
    ->maxFileSize(8 * 1024 * 1024)   // 8 MB
    ->height(480)
    ->columnSpanFull(),

public ?string $document_path = null;

public function setScannerDocumentPath(string $path): void
{
    $this->document_path = $path;
}

use Filament\Forms\Components\ViewField;
use Filament\Forms\Components\Hidden;

Hidden::make('document_path'),

ViewField::make('scanner')
    ->view('pipo-scanner::components.scanner')
    ->columnSpanFull(),

ViewField::make('scanner')
    ->view('pipo-scanner::components.scanner')
    ->viewData([
        'existingPath' => $this->record?->document_path,
        'existingUrl'  => $this->record?->document_path
            ? Storage::disk('public')->url($this->record->document_path)
            : null,
    ])
    ->columnSpanFull(),

public function setScannerDocumentPath(string $path): void
{
    $this->data['document_path'] = $path;
}

return [
    // Storage disk (default: 'public')
    'disk' => env('PIPO_SCANNER_DISK', 'public'),

    // Directory within the disk
    'directory' => env('PIPO_SCANNER_DIRECTORY', 'documents/scanner/temp'),

    // Maximum file size in bytes (default: 4MB)
    'max_file_size' => env('PIPO_SCANNER_MAX_SIZE', 4 * 1024 * 1024),

    // Upload route URL path
    'upload_route' => env('PIPO_SCANNER_UPLOAD_ROUTE', '/pipo-scanner/upload'),
];
bash
php artisan vendor:publish --tag=pipo-scanner-assets
bash
php artisan vendor:publish --tag=pipo-scanner-config
bash
php artisan vendor:publish --tag=pipo-scanner-views