by the table's length */
try {
this.position += outputXref(this.outputStream);
} catch (final IOException e) {
throw new PdfException(e);
}
/* construct the trailer */
final StringBuilder buffer = new StringBuilder();
buffer.append(getTrailerContent());
buffer.append("startxref" + PDFObject.EOL);
buffer.append(xrefPosition + PDFObject.EOL);
buffer.append("%%EOF" + PDFObject.EOL);
/* write the trailer */
byte[] trailer;
try {
trailer = buffer.toString().getBytes(PDFDocument.ENCODING);
} catch (final UnsupportedEncodingException ue) {
trailer = buffer.toString().getBytes();
}
try {
this.outputStream.write(trailer);
} catch (final IOException e) {
throw new PdfException(e);
}
}