pdfLink: this is a nice feature for generating PDF by providing an url to the page to generate as PDF. But I do not want to provide parameters by adding them to the url in get-form.
pdfForm: Somewhat better, But this method gives some other problems. First of all, pictures is lost since the PDF only generates from string, also the layout is not automaticly included in the render call.
So I did the followin tweaks. Sorry Aron, but I had to hack into the PdfService.groovy and PdfController.groovy to get it work and also set up a template in a specific way.
This is what I did:
In PdfService.groovy I added a method to be able to generate a PDF with images for pdfForm, to do this the renderer need to know the baseUri to get find the image.
I added this code:
code
In the method pdfForm for the PdfController.groovy, I replaced code with call to the new method.
code
I then made a template with the following structure to also use the layout, without the applyTemplate, I only got the template code (also note that the template is looked for in views/pdf/):
code
I have not done this with the options for controller and action, just for template, since the g.include seams to return empty content. But I will continue to explore.
! An update. I realized that the pdf-plugin was build for grails 1.1. maybe this was the reason that the g.render in the plugin gave med nothing as a result. I was actually using grails 1.0.4. Using 1.1.1 however makes the action and controller work better. No pictures though, but they show when I am running pdf-plugin as an application after downloading the source.
I will try to find the proper place to address these issues to improve the plugin.
/Peter