if (page.hasExtensionAttachments()) {
List extensionAttachments = page.getExtensionAttachments();
for (int i = 0; i < extensionAttachments.size(); i++) {
Object attObj = extensionAttachments.get(i);
if (attObj instanceof PSExtensionAttachment) {
PSExtensionAttachment attachment = (PSExtensionAttachment)attObj;
if (attachment instanceof PSCommentBefore) {
gen.commentln("%" + attachment.getContent());
} else if (attachment instanceof PSSetupCode) {
gen.writeln(attachment.getContent());
}
}
}
}
// Write any unwritten changes to page device dictionary
if (!pageDeviceDictionary.isEmpty()) {
String content = pageDeviceDictionary.getContent();
if (getPSUtil().isSafeSetPageDevice()) {
content += " SSPD";
} else {
content += " setpagedevice";
}
PSRenderingUtil.writeEnclosedExtensionAttachment(gen, new PSSetPageDevice(content));
}
if (rotate) {
gen.writeln(Math.round(pageHeight) + " 0 translate");
gen.writeln("90 rotate");
}
concatMatrix(1, 0, 0, -1, 0, pageHeight);
gen.writeDSCComment(DSCConstants.END_PAGE_SETUP);
//Process page
super.renderPage(page);
//Show page
gen.showPage();
gen.writeDSCComment(DSCConstants.PAGE_TRAILER);
if (page.hasExtensionAttachments()) {
List extensionAttachments = page.getExtensionAttachments();
for (int i = 0; i < extensionAttachments.size(); i++) {
Object attObj = extensionAttachments.get(i);
if (attObj instanceof PSExtensionAttachment) {
PSExtensionAttachment attachment = (PSExtensionAttachment)attObj;
if (attachment instanceof PSCommentAfter) {
gen.commentln("%" + attachment.getContent());
}
}
}
}
gen.getResourceTracker().writeResources(true, gen);