[macosx] collate option ignored in native print dialog.
Abhinay Reddyreddy
Abhinay.Reddyreddy at mathworks.com
Mon Apr 15 10:13:22 PDT 2013
Hi,
I am trying to use the native print dialog through DialogSelectionType.NATIVE option on Mac OS X. In this dialog if a user selects the collate option from Paper Handling options, the output from the printer is not collated. i.e The user expected output in the sequence "Page 1 Page 2 Page 1 Page2..." but the printed sequence is "Page1 Page1 .. Page 2 Page 2".
Is there any workaround to get the output to not ignore the user selection for collate option ??
Here is a simple test case.
import java.awt.*;
import javax.swing.*;
import java.awt.print.*;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.DialogTypeSelection;
import javax.print.attribute.standard.SheetCollate;
import javax.print.attribute.standard.Copies;
public class SunTest implements Printable
{
public void startTestCase()
{
PrinterJob pj = PrinterJob.getPrinterJob();
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(DialogTypeSelection.NATIVE);
pras.add(SheetCollate.COLLATED);
pras.add(new Copies(2));
pj.setPrintable(this);
if (pj.printDialog(pras))
{
try{
pj.print(pras);
} catch (Exception e) {
}
}
}
public int print(Graphics g, PageFormat pf, int pageNo) throws PrinterException
{
if(pageNo > 2)
return Printable.NO_SUCH_PAGE;
else {
g.setColor(Color.black);
Font fnt = new Font("Serif", Font.PLAIN, 32); /* Cover page */
g.setFont(fnt);
g.drawString("Page no: "+Integer.toString(pageNo), 100, 200);
return Printable.PAGE_EXISTS;
}
}
public static void main (String []Args) {
SunTest st = new SunTest ();
st.startTestCase ();
}
}
- Abhinay.
More information about the macosx-port-dev
mailing list