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
krekas
krekas12mo ago
dompdf won't work as it won't style your page
Dennis Koch
Dennis Koch12mo ago
Best you can try is the browsers print feature. DomPDF doesn'T have the support for CSS that would be needed.
tinkypinky
tinkypinkyOP12mo ago
Can I create an action that runs JS like window.print but without navigation items
krekas
krekas12mo ago
create a separate view for pdf
tinkypinky
tinkypinkyOP12mo ago
Can I use Filament Form Schema for that view but without Navigation. The Form is pretty long and don't wanna code again😂
Dennis Koch
Dennis Koch12mo ago
You can create a Livewire component with that form.
tinkypinky
tinkypinkyOP12mo ago
Can I create a Filament Page? Its also a livewire component?
krekas
krekas12mo ago
yes
Dennis Koch
Dennis Koch12mo ago
Yes, but a Filament page has the full layout with sidebar etc.
tinkypinky
tinkypinkyOP12mo ago
Oh. Got it. Let me try that.
Dennis Koch
Dennis Koch12mo ago
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.
tinkypinky
tinkypinkyOP12mo ago
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?
krekas
krekas12mo ago
How are triggering the action?
tinkypinky
tinkypinkyOP12mo ago
Just trying by using browser at the moment.
Felipe Castro
Felipe Castro11mo ago
Hi.. did you solve the issue? if so, would you share the sollution as i find myself with the same problem.
SirFat
SirFat11mo ago
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.

Did you find this page helpful?