a-ok Posted May 21, 2021 Share Posted May 21, 2021 Is there a modern way to create PDF on the fly these days with the data from PW? mPDF seems fairly old school and only supports tables etc but was looking for something that supports flexbox/css grid etc. I could just use a print stylesheet but it needs to download a PDF, ideally, on click. Any thoughts? I've had a look at RockPdf and Pages2Pdf but wondered if there was anything else? Thanks! Rich 1 Link to comment Share on other sites More sharing options...
dragan Posted May 21, 2021 Share Posted May 21, 2021 Well, if you have the budget, you could use one of the commercial services out there which have an API. This article suggests using Chrome in headless mode, but I have no idea how difficult it is to install, and what the server requirements are: https://peterdev.pl/2019/01/11/picking-a-php-tool-to-generate-pdfs/ Link to comment Share on other sites More sharing options...
a-ok Posted May 21, 2021 Author Share Posted May 21, 2021 3 minutes ago, dragan said: Well, if you have the budget, you could use one of the commercial services out there which have an API. This article suggests using Chrome in headless mode, but I have no idea how difficult it is to install, and what the server requirements are: Thanks @dragan – I tried to find some decent APIs but couldn't find anything decent... are you aware of any? And yes I was looking at the headless Chrome stuff too but was quickly confused haha! Link to comment Share on other sites More sharing options...
a-ok Posted May 21, 2021 Author Share Posted May 21, 2021 I was also looking to see if I could do it with JSON so output the data using PW to JSON then supplying that either to an API or plugin... Link to comment Share on other sites More sharing options...
dragan Posted May 21, 2021 Share Posted May 21, 2021 8 minutes ago, a-ok said: I tried to find some decent APIs but couldn't find anything decent... are you aware of any? https://pdfmyurl.com/ claims to support HTML5 + CSS3, but I haven't tested it so far. Link to comment Share on other sites More sharing options...
iank Posted May 21, 2021 Share Posted May 21, 2021 I used PDFLayer (https://pdflayer.com/) recently in a project, and it did a good job of rendering some quite complex CSS. It's free to sign up for an api and you get 100 api calls/month with the free version. It could get expensive though if you have a lot of API calls to make (e.g. $9.99/month for 1000 api calls, $39.99 for 10,000). It was quite straightforward to use though, and you can set it to "test" mode for development, where it will overlay "Sample" on the PDF output, but not use any of your API requests. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now