-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b116
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8277367 | 8u331 | Suman Rajkumaar Kodandarama | P3 | Resolved | Fixed | b01 |
JDK-8277730 | 8u321 | Suman Rajkumaar Kodandarama | P3 | Resolved | Fixed | b06 |
The OS X platform print dialog has an option to set the page ranges.
If this is done it ought to be reported back in the AttributeSet.
The following program can be used to illustrate this does not happen
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.print.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
public class PP implements Pageable, Printable {
public static void main(String args[]) throws Exception {
HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
PrinterJob j = PrinterJob.getPrinterJob();
j.setPageable(new PP());
as.add(DialogTypeSelection.NATIVE);
j.printDialog(as);
Attribute attrs[] = as.toArray();
for (int i=0; i<attrs.length; i++) System.out.println(attrs[i]);
j.print(as);
//Thread.sleep(10000);
}
public int getNumberOfPages() {
return UNKNOWN_NUMBER_OF_PAGES;
}
public PageFormat getPageFormat(int pageIndex) {
Thread.dumpStack();
//if (pageIndex > 2) throw new IndexOutOfBoundsException();
PageFormat pf = new PageFormat();
Paper p = pf.getPaper();
p.setImageableArea(36, 36, p.getWidth()-72, p.getHeight()-72);
pf.setPaper(p);
return pf;
}
public Printable getPrintable(int pageIndex) {
//if (pageIndex > 2) throw new IndexOutOfBoundsException();
return this;
}
public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
System.out.println("****"+pgIndex);
if (pgIndex > 2) return Printable.NO_SUCH_PAGE;
double iw = pgFmt.getImageableWidth();
double ih = pgFmt.getImageableHeight();
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pgFmt.getImageableX(), pgFmt.getImageableY());
g2d.drawString("top left of page format",20,20 );
return Printable.PAGE_EXISTS;
}
}
If this is done it ought to be reported back in the AttributeSet.
The following program can be used to illustrate this does not happen
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.print.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
public class PP implements Pageable, Printable {
public static void main(String args[]) throws Exception {
HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
PrinterJob j = PrinterJob.getPrinterJob();
j.setPageable(new PP());
as.add(DialogTypeSelection.NATIVE);
j.printDialog(as);
Attribute attrs[] = as.toArray();
for (int i=0; i<attrs.length; i++) System.out.println(attrs[i]);
j.print(as);
//Thread.sleep(10000);
}
public int getNumberOfPages() {
return UNKNOWN_NUMBER_OF_PAGES;
}
public PageFormat getPageFormat(int pageIndex) {
Thread.dumpStack();
//if (pageIndex > 2) throw new IndexOutOfBoundsException();
PageFormat pf = new PageFormat();
Paper p = pf.getPaper();
p.setImageableArea(36, 36, p.getWidth()-72, p.getHeight()-72);
pf.setPaper(p);
return pf;
}
public Printable getPrintable(int pageIndex) {
//if (pageIndex > 2) throw new IndexOutOfBoundsException();
return this;
}
public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
System.out.println("****"+pgIndex);
if (pgIndex > 2) return Printable.NO_SUCH_PAGE;
double iw = pgFmt.getImageableWidth();
double ih = pgFmt.getImageableHeight();
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pgFmt.getImageableX(), pgFmt.getImageableY());
g2d.drawString("top left of page format",20,20 );
return Printable.PAGE_EXISTS;
}
}
- backported by
-
JDK-8277367 [macosx] Print dialog does not update attribute set with page range
- Resolved
-
JDK-8277730 [macosx] Print dialog does not update attribute set with page range
- Resolved