return this.userAgent;
}
+ /** {@inheritDoc} */
+ public void startDocumentHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endDocumentHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void startDocumentTrailer() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endDocumentTrailer() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void startPageHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endPageHeader() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void startPageTrailer() throws IFException {
+ //nop
+ }
+
+ /** {@inheritDoc} */
+ public void endPageTrailer() throws IFException {
+ //nop
+ }
+
private AffineTransform combine(AffineTransform[] transforms) {
AffineTransform at = new AffineTransform();
for (int i = 0, c = transforms.length; i < c; i++) {
String EL_DOCUMENT = "document";
String EL_HEADER = "header";
+ String EL_TRAILER = "trailer";
String EL_PAGE_SEQUENCE = "page-sequence";
String EL_PAGE = "page";
String EL_PAGE_HEADER = "page-header";
* ]*
* endPageSequence()
* ]*
+ * startDocumentTrailer()
+ * [handleExtension()]*
+ * endDocumentTrailer()
* endDocument()
*
* #box:
*/
void endDocumentHeader() throws IFException;
+ /**
+ * Indicates the start of the document trailer. This method is called after the last
+ * page sequence. Extensions sent to the painter between
+ * {@code #startDocumentTrailer()} and {@code #endDocumentTrailer()} apply to the document as
+ * a whole and is used for document-level content that is only known after all pages have
+ * been rendered (like named destinations or the bookmark tree).
+ * @throws IFException if an error occurs while handling this event
+ */
+ void startDocumentTrailer() throws IFException;
+
+ /**
+ * Indicates the end of the document trailer. This method is called right before the
+ * {@code #endDocument()} method.
+ * @throws IFException if an error occurs while handling this event
+ */
+ void endDocumentTrailer() throws IFException;
+
/**
* Indicates the start of a new page sequence.
* @param id the page sequence's identifier (or null if none is available)
this.elementMappingRegistry = elementMappingRegistry;
elementHandlers.put(EL_DOCUMENT, new DocumentHandler());
elementHandlers.put(EL_HEADER, new DocumentHeaderHandler());
+ elementHandlers.put(EL_TRAILER, new DocumentTrailerHandler());
elementHandlers.put(EL_PAGE_SEQUENCE, new PageSequenceHandler());
elementHandlers.put(EL_PAGE, new PageHandler());
elementHandlers.put(EL_PAGE_HEADER, new PageHeaderHandler());
}
+ private class DocumentTrailerHandler extends AbstractElementHandler {
+
+ public void startElement(Attributes attributes) throws IFException {
+ painter.startDocumentTrailer();
+ }
+
+ public void endElement() throws IFException {
+ painter.endDocumentTrailer();
+ }
+
+ }
+
private class PageSequenceHandler extends AbstractElementHandler {
public void startElement(Attributes attributes) throws IFException {
painter.endPageSequence();
this.inPageSequence = false;
}
+ painter.startDocumentTrailer();
finishOpenGoTos();
if (this.bookmarkTree != null) {
painter.handleExtensionObject(this.bookmarkTree);
}
+ painter.endDocumentTrailer();
painter.endDocument();
} catch (IFException e) {
handleIFExceptionWithIOException(e);
}
}
+ /** {@inheritDoc} */
+ public void startDocumentTrailer() throws IFException {
+ try {
+ startElement(EL_TRAILER);
+ } catch (SAXException e) {
+ throw new IFException("SAX error in startDocumentTrailer()", e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void endDocumentTrailer() throws IFException {
+ try {
+ endElement(EL_TRAILER);
+ } catch (SAXException e) {
+ throw new IFException("SAX error in startDocumentTrailer()", e);
+ }
+ }
+
/** {@inheritDoc} */
public void endDocument() throws IFException {
try {
}
}
- /** {@inheritDoc} */
- public void startDocumentHeader() throws IFException {
- }
-
/** {@inheritDoc} */
public void endDocumentHeader() throws IFException {
pdfUtil.generateDefaultXMPMetadata();
generator.concatenate(basicPageTransform);
}
- /** {@inheritDoc} */
- public void startPageHeader() throws IFException {
- }
-
- /** {@inheritDoc} */
- public void endPageHeader() throws IFException {
- }
-
/** {@inheritDoc} */
public void startPageContent() throws IFException {
this.state = IFState.create();
assert this.state.pop() == null;
}
- /** {@inheritDoc} */
- public void startPageTrailer() throws IFException {
- }
-
- /** {@inheritDoc} */
- public void endPageTrailer() throws IFException {
- }
-
/** {@inheritDoc} */
public void endPage() throws IFException {
try {
/** {@inheritDoc} */
public void endDocument() throws IFException {
+ //nop
}
/** {@inheritDoc} */
}
}
- /** {@inheritDoc} */
- public void startPageHeader() throws IFException {
- }
-
- /** {@inheritDoc} */
- public void endPageHeader() throws IFException {
- }
-
/** {@inheritDoc} */
public void startPageContent() throws IFException {
super.startPageContent();
super.endPageContent();
}
- /** {@inheritDoc} */
- public void startPageTrailer() throws IFException {
- }
-
- /** {@inheritDoc} */
- public void endPageTrailer() throws IFException {
- }
-
/** {@inheritDoc} */
public void endPage() throws IFException {
try {