//Write trailer
gen.writeDSCComment(DSCConstants.TRAILER);
writeExtensions(COMMENT_DOCUMENT_TRAILER);
gen.writeDSCComment(DSCConstants.PAGES, new Integer(this.currentPageNumber));
new DSCCommentBoundingBox(this.documentBoundingBox).generate(gen);
new DSCCommentHiResBoundingBox(this.documentBoundingBox).generate(gen);
gen.getResourceTracker().writeResources(false, gen);
gen.writeDSCComment(DSCConstants.EOF);
gen.flush();
log.debug("Rendering to PostScript complete.");
if (psUtil.isOptimizeResources()) {