Methods inherited from class java.lang.Object

Constructor Detail

AbstractPdfView

public AbstractPdfView()

This constructor sets the appropriate content type "application/pdf".
Note that IE won't take much notice of this, but there's not a lot we
can do about this. Generated documents should have a ".pdf" extension.

Method Detail

generatesDownloadContent

The default implementation returns false. Subclasses are
encouraged to return true here if they know that they are
generating download content that requires temporary caching on the
client side, typically via the response OutputStream.

The first step will be preparing the request: In the JSP case,
this would mean setting model objects as request attributes.
The second step will be the actual rendering of the view,
for example including the JSP via a RequestDispatcher.

buildPdfMetadata

Populate the iText Document's meta fields (author, title, etc.).
Default is an empty implementation. Subclasses may override this method
to add meta fields such as title, subject, author, creator, keywords, etc.
This method is called after assigning a PdfWriter to the Document and
before calling document.open().

Subclasses must implement this method to build an iText PDF document,
given the model. Called between Document.open() and
Document.close() calls.

Note that the passed-in HTTP response is just supposed to be used
for setting cookies or other HTTP headers. The built PDF document itself
will automatically get written to the response after this method returns.

Parameters:

model - the model Map

document - the iText Document to add elements to

writer - the PdfWriter to use

request - in case we need locale etc. Shouldn't look at attributes.

response - in case we need to set cookies. Shouldn't write to it.

Throws:

java.lang.Exception - any exception that occured during document building