Last updated
Last updated
In order to provide PDF generating capabilities within your AdminJS instance you will have to take advantage of the custom components feature and the .
First, create a new instance of the Component Loader, and create a Components object that will hold the custom components.
Remember to !
Then, we will have to append the PDF generator to a resource and add a handler for the record passed within context.
With that ready, we can focus on the PDF generator function.
Now that our PDFs can be created from the record passed within context, we will need to create a place where the pdfs will be stored. Create a folder called 'pdfs', which we will make public through express.
Make sure you set the static path before building the router!
Last, but not least, we need a way to open the freshly generated PDF file. Since we've already defined the custom component we're going to stick to the same naming scheme.
For physical applications of AdminJS a pdf generator can come in handy, either for generating shipping labels or work orders.