service.printerName, service.getPrinterProps()
.getStructPtr());
final AttributeSet docAttrs = doc.getAttributes();
final Printable printable = castDoc(doc, Printable.class);
final PageFormat format = getPageFormat(docAttrs, attributes);
final PageRanges ranges = getAttribute(PageRanges.class, docAttrs,
attributes);
int res = Printable.PAGE_EXISTS;
try {
startJob(pdc, getDocName(printable, docAttrs, attributes),
getDestinationPath(attributes));
for (int i = 0; res == Printable.PAGE_EXISTS; i++) {
if ((ranges != null) && !ranges.contains(i)) {
continue;
}
res = printPrintable(printable, pdc, format, i);
}