Generate PDF of page and save to file set upon edit
Permalink
One of my clients has a series of products and for each product they have a datasheet that they want as a downloadable pdf. Up until now, I've been manually editing the sheets and uploading the pdfs to their C5 site.
I've been working on building the data sheets as native c5 pages, so they can make manual edits using the c5 interface, then generate a pdf file using a third party eg. pdfmyurl.com. This works now, but the file generation can be quite slow.
Prior to using a third party to generate the pdfs, I built a c5 block that generated a pdf server-side using the mPdf library, but it wasn't very robust. It sometimes generated just the header and footer in the resultant pdf and the only way to get it to work again was to force it to generate a blank pdf. Then it would intermittently start generating blanks again with no errors in the server logs, and the output from debugging all looked fine. I think it was some sort of server caching/resources issue (they are on a shared hosting plan). In any case, it was too flaky for real world use.
So my ideal workflow would be for the client to be able to edit the datasheet in c5, generate a pdf (using either the external service or a c5 block) and add that pdf to a named c5 fileset to make it available for end users. This way, the generation time for the pdf would only happen upon edit, rather than every time it was downloaded.
Has anyone else done something like this before? Is it an exercise in futility :-)
I've been working on building the data sheets as native c5 pages, so they can make manual edits using the c5 interface, then generate a pdf file using a third party eg. pdfmyurl.com. This works now, but the file generation can be quite slow.
Prior to using a third party to generate the pdfs, I built a c5 block that generated a pdf server-side using the mPdf library, but it wasn't very robust. It sometimes generated just the header and footer in the resultant pdf and the only way to get it to work again was to force it to generate a blank pdf. Then it would intermittently start generating blanks again with no errors in the server logs, and the output from debugging all looked fine. I think it was some sort of server caching/resources issue (they are on a shared hosting plan). In any case, it was too flaky for real world use.
So my ideal workflow would be for the client to be able to edit the datasheet in c5, generate a pdf (using either the external service or a c5 block) and add that pdf to a named c5 fileset to make it available for end users. This way, the generation time for the pdf would only happen upon edit, rather than every time it was downloaded.
Has anyone else done something like this before? Is it an exercise in futility :-)
Thanks! I'm looking at it now. I don't know why I didn't think to look in the Marketplace. I'm kind of a DIY guy :-)
It looks like the add on uses mPdf too. If I can get it to reliably generate pdfs, I think I can work out the rest. Thanks again.
It looks like the add on uses mPdf too. If I can get it to reliably generate pdfs, I think I can work out the rest. Thanks again.
I have done something similar but I combined it with this free add-on:
http://www.concrete5.org/marketplace/addons/csv-displayer/...
It lets you create part of the data sheet in Excel, export it to CSV and upload it to be included in the area that gets saved as a PDF. This might make creating the data sheet a little easier.
You might want to also check out 'Designer Content' to create custom blocks that include the fields you need.
http://www.concrete5.org/marketplace/addons/designer-content/...
http://www.concrete5.org/marketplace/addons/csv-displayer/...
It lets you create part of the data sheet in Excel, export it to CSV and upload it to be included in the area that gets saved as a PDF. This might make creating the data sheet a little easier.
You might want to also check out 'Designer Content' to create custom blocks that include the fields you need.
http://www.concrete5.org/marketplace/addons/designer-content/...
http://www.concrete5.org/marketplace/addons/save-area-to-pdf/...
I imagine your users editing the content through C5, however you have that set up, and then creating the pdf. Then simply upload the file and add it to a "downloads" page for visitor availability. I could be way off base as well :D