Convert View with CSS, JS and PDF Images

Asked

Viewed 620 times

3

I have a view on Laravel where I load multiple charts. This view is composed of HTML, Images, CSS and JS.

I need to convert (export) this page to PDF via a JS or PHP function.

I can’t find a library that "copy" faithfully the page and export it in PDF. The closest I got was Dompdf, but more mess...

I tried to use the Dompdf and the jsPSF.

How could I do that ?

I was reading this post: /a/74300/23919

But it works on a hosted server ?

  • Your CSS must be complex... and the library doesn’t support everything.

  • Yes. So I want something to do it faithfully.

  • I did a quick search on this. Have a look at this link: http://www.mpdf1.com/

2 answers

1

0


I used the barryvdh/Laravel-dompdf, it has a simple use, and I rendered in pdf using including the bootstrap, another option is the barryvdh/Laravel-Snappy, liked less and is a little more complex, needs a component installed on the server so it is able to not work in certain hosts. I recommend using the first mentioned, it is likely that you will have to adjust your html and css, but if you have problems, you can open a new question by sending the example of the code and the error.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.