Dis­play­tag is a very nice JSP Com­po­nent to dis­play data lists. If you don’t know Dis­play­tag, this arti­cle is prob­a­bly not for you…

Any­way Dis­play­tag pro­vides a func­tion to export the list as PDF. Unfor­tu­nally there is a prob­lem with large lists (>20k entries), it just takes us all the mem­ory and your appli­ca­tion may throw an Out­OfMem­o­ryEx­cep­tion. I cre­ated a cus­tom PDF export class which should fix this prob­lem and add’s the pos­si­bil­ity to define a cus­tom header and footer line.

Just add the fol­low­ing lines to your displaytag.properties file:

1
2
pdf.export.header=Your Header
pdf.export.footer=Your footer — Page

export.pdf.class=com.CHANGE.IT.NicePdfExport

and add THIS file to your project.