Download the PHP package dante918/livewire-pdf-preview without Composer
On this page you can find all versions of the php package dante918/livewire-pdf-preview. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dante918/livewire-pdf-preview
More information about dante918/livewire-pdf-preview
Files in dante918/livewire-pdf-preview
Package livewire-pdf-preview
Short Description Adds a component to easily preview livewire PDFs
License MIT
Homepage https://github.com/DanteB918/livewire-pdf-preview
Informations about the package livewire-pdf-preview
Example
Installation
You can install the package via composer:
Please skip the next few installation steps if your application already has PDF.js installed.
Next, you must export the package public scripts. To do this run
This command will export a vendor/livewire-pdf-preview
folder under the public
directory of your app which is used by the @livewirePdfPreviewScripts
directive.
include the @livewirePdfPreviewScripts
directive next to your other app scripts
Requirements
This package requires the following packages/libraries to work:
Laravel Livewire v3
(https://livewire.laravel.com/)PDF.js
(https://mozilla.github.io/pdf.js/)
Please follow each package/library instructions on how to set them properly in your project.
Note: if you run the installation command and added the directives, that installs PDF.js.
Usage
You'll have a livewire component with an upload field, then the canvas, like so:
If you already have PDF.js in your application, you'll have to specify the pdf.worker.js
path and pass it to the component. This is not required if that JS was set up via the command + @livewirePdfPreviewScripts
method.
Be sure that your component has the WithFileUploads
trait, if you are using Livewire file uploads. More information can be found in the Livewire documentation.
It's preferred to always have the key
attribute for this component so that it will re-render any time the PDF has been changed.
Contributing
Feel free to open Pull requests with bug fixes and features. I'll do my best to keep an eye on those. Feel free to open issues with bug reports or feature requests. Bug fixes will take priority. I welcome contributions from the community and look forward to working with you to improve this project.