### Install filament-pdf-viewer via Composer Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Install the package via Composer. Requires Laravel 11 and Filament 5.x. ```bash composer require joaopaulolndev/filament-pdf-viewer:^3.0 ``` -------------------------------- ### Run package tests Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Run the package test suite. ```bash composer test ``` -------------------------------- ### Publish filament-pdf-viewer views Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Optionally publish the package views for customization. ```bash php artisan vendor:publish --tag="filament-pdf-viewer-views" ``` -------------------------------- ### Use PdfViewerEntry in a Filament infolist Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Add a PDF viewer entry to a Filament infolist. Displays a PDF from a database record. ```php 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') ]); } ``` -------------------------------- ### Wrap PdfViewerEntry in a collapsible Section Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Wrap the PdfViewerEntry in a collapsible Section with a description that prevents the PDF from being downloaded. ```php 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() ]); ]); } ``` -------------------------------- ### Set PDF URL with fileUrl in PdfViewerEntry Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Use the fileUrl method to display a PDF from a URL without a database record. The comment notes this is for PDFs without a database. ```php 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 PdfViewerField in a Filament form Source: https://github.com/joaopaulolndev/filament-pdf-viewer/blob/3.x/README.md Add a PDF viewer form field to a Filament resource form. The field displays a PDF from a database record. ```php 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') ]); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.