Displaytag is a very nice JSP Component to display data lists. If you don’t know Displaytag, this article is probably not for you…

Anyway Displaytag provides a function to export the list as PDF. Unfortunally there is a problem with large lists (>20k entries), it just takes us all the memory and your application may throw an OutOfMemoryException. I created a custom PDF export class which should fix this problem and add’s the possibility to define a custom header and footer line.

Just add the following 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.