Hi everyone,
I’m new to Grav CMS, so far it’s an incredible CMS to create small website or blog, I don’t know if it can be used for big website (online shop, catalog with large database, …).
Here’s my problem, I created a collection of flex-object that are populated with a front-end form. I would like to add the possibility to Export to PDF the entire list or a filtered list.
I wonder:
- How to create filtre inside the flex-object collection in the admin panel ?
- How to create an exportToPdf function ? Is it better to create a plugin or just add a php script somewhere in the file structure and add a button at the top next to the export one ?
Thanks in advance for your help.
Have a nice day
@Foorinto, As far as I know, Grav does not provide any way to generate PDF files. I see two different approaches:
- Create a listing in Admin, and use the Print functionality of the browser to generate a PDF. I guess you can trigger the functionality using Javascript.
- Create a plugin, require any PDF library and use the library to generate a PDF file.
I have not experience with any such library so I cannot tell how easy it will be to format raw data into a nice looking PDF.
Thanks for your answer.
I was thinking about the print function of the browser but I need something custom.
I also though making a front page with an hidden URL but not really secure
So yes I think I’ll go with the plugin that require FPDF. Never tried to create a plugin, is there good tutorial or references to create one (beside the documentation) ?
Thnaks again for your help.
@Foorinto, There are two main sources of documentation that come handy when developing a plugin:
- The Plugin section of the docs.
The mentioned Devtools will generate a complete skeleton when using $ bin/plugin devtools new-plugin
.
Also pay attention to subsections:
- The Grav API section
1 Like
Great, I’ll take a look at these sections.
Thanks.