private DocFlavor assignDocFlavor() throws Exception {
return config.getDocFlavor();
}
private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
if (config.getCopies() >= 1) {
printRequestAttributeSet.add(new Copies(config.getCopies()));
} else {
throw new PrintException("Number of print copies should be greater than zero");
}
printRequestAttributeSet.add(config.getMediaSizeName());
printRequestAttributeSet.add(config.getInternalSides());
printRequestAttributeSet.add(config.getInternalOrientation());
if (config.getMediaTray() != null) {
MediaTray mediaTray = resolveMediaTray(config.getMediaTray());
if (mediaTray == null) {
throw new PrintException("mediatray not found " + config.getMediaTray());
}
printRequestAttributeSet.add(mediaTray);
}
return printRequestAttributeSet;
}