Aman Adhikari
Aman Adhikari

Reputation: 3280

Grails Export Plugin Report's Design Customization

Can we customize the design of the "grails export plugin's " report ? Generally now, if we export a list (i.e a table) using export plugin in pdf it gives us the plain table. Can we add a logo or make any other kind of similar custom changes to the pdf ? Is there any kind of jrxml file which we can customize ourself that we do on other export API like Dynamic Jasper ?

Thanks in Advance.

Upvotes: 1

Views: 543

Answers (1)

V H
V H

Reputation: 8587

From what I can see (not tested)

http://grails.org/plugin/export

Map parameters = [title: "Cool books", "column.widths": [0.2, 0.3, 0.5]]

exportService.export(params.format, response.outputStream, Book.list(params), fields, labels, formatters, parameters)

https://github.com/gpc/grails-export/blob/master/src/groovy/de/andreasschmitt/export/exporter/DefaultPDFExporter.groovy#L38

if (getParameters().containsKey(("pdf.logo"))){
String logoPath = getParameters().get("pdf.logo")
Image logo = Image.getInstance(logoPath)
document.add(logo)
}

so if you have an additional parameter of pdf.log in parameters with path to image - it should work -

Map parameters = [title: "Cool books", "column.widths": [0.2, 0.3, 0.5], "pdf.logo": '/path/to/image/image.jpg' ]

Upvotes: 2

Related Questions