Print Pdf of Form Schema Exactly
Is it possible to print pdf of form schema as it looks exactly on browser? Is there a route that can be passed to Dompdf so that It Prints the form exactly as it appears?
17 Replies
dompdf won't work as it won't style your page
Best you can try is the browsers print feature. DomPDF doesn'T have the support for CSS that would be needed.
Can I create an action that runs JS like window.print but without navigation items
create a separate view for pdf
Can I use Filament Form Schema for that view but without Navigation. The Form is pretty long and don't wanna code again😂
You can create a Livewire component with that form.
Can I create a Filament Page? Its also a livewire component?
yes
Yes, but a Filament page has the full layout with sidebar etc.
Oh. Got it. Let me try that.
If that's okay, you can try using the existing page. You need to create an instance and call
render()
probably and then pass that HTML to borwsershot or similar.I am able to get a simple html page with just the form and nothing else. I am using 3 columns as default but when I click print/save-as-pdf the browser just spans a single form field to whole page. What could be the issue?
How are triggering the action?
Just trying by using browser at the moment.
Hi.. did you solve the issue? if so, would you share the sollution as i find myself with the same problem.
I would guess it depends what your definition of 'exactly like it appears'.
Screen and print will always inherently be different as documents, for a start, have fixed margins for page size.
In my experience, I end up building specific renderable solutions using XSL-FO. Depends on the problem you're solving.
What issues? Have you checked https://laraveldaily.com/post/filament-export-record-to-pdf-two-ways ?
Laravel Daily
Filament: Export Record to PDF - Two Ways