A common use case for using Puppeteer PDF generation is to grab a copy of your dashboard so that you can send your clients, customers, or management a copy of that via email or some other mechanism on a daily schedule, weekly, etc.
You built the dashboard. It has all the metrics you want. You spent a lot of time making it look good. So why not reuse it to send it out as a PDF report? As an attachment to an email, to increase the visibility of the metrics, or to capture a point in time as a reference.
Building this yourself will take valuable time and money. We make this completely painless using cloudlayer.io, the Puppeteer PDF report generation service, which utilizes our Url to PDF endpoint. You could write a small amount of code to do this via our REST-based API, or you could also use our Zapier integration and have Zapier handle the schedule, calling the API and sending out the result, all for you with no code written.
Our service uses Puppeteer, a headless Chrome, to convert a URL to a PDF. We then upload the PDF to our global CDN network for fast access. We have added support for things like authentication and thumbnail generation as well.
Using Puppeteer PDF Generation
Dashboards are often protected by some form of authentication requiring a user to log in to view the dashboard. We support multiple ways of passing authentication to our service to handle this scenario.
How to Handle Authentication with Puppeteer
- Cookies - You can generate a session cookie and pass it into our service to emulate any user. You may have to create a special user with a long-lived session, so you don't have to update the session cookie very often.
- Basic Auth - You could set up a special path using basic auth and then pass in the credentials to our service, and we will use that to authenticate.
- Unique URL - You could use a unique URL that is a secret, and we will use that to gain access.
- Combination - You could use a combination of the above-mentioned methods, such as a Unique URL combined with Basic Auth, etc.
Since there are many unique authentication setups out there, you will need to find the solution that works best for you. If we are missing a method, please get in touch with our support, and we will work with you on a solution.
How to Make Sure your Dashboard is Fully Loaded
To ensure that your dashboard is fully loaded, you will need to understand a bit about how your dashboard works.
If the dashboard is real-time and keeps open socket connections to keep streaming live data, you would change your `waitUntil` parameter to "networkidle2". If it's not real-time, fetches and completes, and does not keep open connections, you would want to use "networkidle0".
Other options help ensure your dashboard is fully loaded in addition to the "waitUntil" parameter. Such as, the `waitForSelector` parameter will watch for an element on the page to become visible or not visible.
Before setting up your Zap, you will need to create a cloudlayer.io account. We have a free account that offers a generous amount of free document generation. This account never expires. You can upgrade to one of our paid versions once you have used up your free document generations later.
Setup Zapier to Schedule Automatic PDF Generation
Zapier will let you set this integration up without writing a single line of code. You can use one of our pre-defined Zap templates to get started.
- Zap Template: Convert URL to PDF on Schedule
- Zap Template: Convert HTML Template Report to PDF on Schedule
We created the above Zap templates to make it easy for you to get started generating reports on a schedule. You can use them and customize them to do what you need.
Use Zapier for Easier Integration
Using Zapier will let you easily integrate your solution for sending our reports. Here are a couple of scenarios you could easily accomplish.
Send Dashboard Report as an Email
In this scenario, you would take a dashboard, either an existing one on the web, such as a URL, or one built from an HTML Template, and send that out as an email.
You could start with one of our templates that uses Zapier scheduling. It will capture the Dashboard on a schedule, our service will generate the PDF, and then using an email integration partner with Zapier (there are many), you will send out the URL our service generates in an email.
Create Historical Snapshots of your Dashboard
How about creating historical snapshots of your Dashboard to record its state at various times?
Again you would use our Zap Templates as a starting point, and then you could take the URL we generate and add it to your database, a sheet in Google Sheets, or a table in Airtable. It's your choice.
Wrapping it up
To conclude, taking your dashboard or creating a report from an HTML Template is made easy using our service. We take all the hard work out of the equation, and all you need to worry about is solving your business problem.