PHP code example of joaopaulolndev / filament-pdf-viewer

1. Go to this page and download the library: Download joaopaulolndev/filament-pdf-viewer 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/ */

    

joaopaulolndev / filament-pdf-viewer example snippets


use Joaopaulolndev\FilamentPdfViewer\Forms\Components\PdfViewerField;

public static function form(Schema $schema): Schema
{
    return $schema
        ->schema([
            PdfViewerField::make('file')
                ->label('View the PDF')
                ->minHeight('40svh')
        ]);
}

use Joaopaulolndev\FilamentPdfViewer\Infolists\Components\PdfViewerEntry;

public static function infolist(Schema $schema): Schema 
{
    return $schema
        ->schema([
            PdfViewerEntry::make('file')
                ->label('View the PDF')
                ->minHeight('40svh')
        ]);
}

use Joaopaulolndev\FilamentPdfViewer\Infolists\Components\PdfViewerEntry;

public static function infolist(Schema $schema): Schema 
{
    return $schema
        ->schema([
            PdfViewerEntry::make('file')
                ->label('View the PDF')
                ->minHeight('40svh')
                ->fileUrl(Storage::url('dummy.pdf')) // Set the file url if you are getting a pdf without database
                ->columnSpanFull()
        ]);
}

use Joaopaulolndev\FilamentPdfViewer\Infolists\Components\PdfViewerEntry;

public static function infolist(Schema $schema): Schema 
{
    return $schema
        ->schema([
            Section::make('PDF Viewer')
                ->description('Prevent the PDF from being downloaded')
                ->collapsible()
                ->schema([
                    PdfViewerEntry::make('file')
                        ->label('View the PDF')
                        ->minHeight('40svh')
                        ->fileUrl(Storage::url('dummy.pdf')) // Set the file url if you are getting a pdf without database
                        ->columnSpanFull()
                ]);        
        ]);
}
bash
php artisan vendor:publish --tag="filament-pdf-viewer-views"