605 double paperWidth = pageFormat.getPaper().getWidth();
606
607 /* PostScript printers can always generate uncollated copies.
608 */
609 mPSStream.print("<< /PageSize [" +
610 paperWidth + " "+ paperHeight+"]");
611
612 final PrintService pservice = getPrintService();
613 Boolean isPS = (Boolean)java.security.AccessController.doPrivileged(
614 new java.security.PrivilegedAction() {
615 public Object run() {
616 try {
617 Class psClass = Class.forName("sun.print.IPPPrintService");
618 if (psClass.isInstance(pservice)) {
619 Method isPSMethod = psClass.getMethod("isPostscript",
620 (Class[])null);
621 return (Boolean)isPSMethod.invoke(pservice, (Object[])null);
622 }
623 } catch (Throwable t) {
624 }
625 return Boolean.TRUE;
626 }
627 }
628 );
629 if (isPS) {
630 mPSStream.print(" /DeferredMediaSelection true");
631 }
632
633 mPSStream.print(" /ImagingBBox null /ManualFeed false");
634 mPSStream.print(isCollated() ? " /Collate true":"");
635 mPSStream.print(" /NumCopies " +getCopiesInt());
636
637 if (sidesAttr != Sides.ONE_SIDED) {
638 if (sidesAttr == Sides.TWO_SIDED_LONG_EDGE) {
639 mPSStream.print(" /Duplex true ");
640 } else if (sidesAttr == Sides.TWO_SIDED_SHORT_EDGE) {
641 mPSStream.print(" /Duplex true /Tumble true ");
642 }
643 }
644 mPSStream.println(" >> setpagedevice ");
645 }
807
808 final PrintService pservice = getPrintService();
809 Boolean isPS =
810 (Boolean)java.security.AccessController.doPrivileged(
811
812 new java.security.PrivilegedAction() {
813 public Object run() {
814 try {
815 Class psClass =
816 Class.forName("sun.print.IPPPrintService");
817 if (psClass.isInstance(pservice)) {
818 Method isPSMethod =
819 psClass.getMethod("isPostscript",
820 (Class[])null);
821 return (Boolean)
822 isPSMethod.invoke(pservice,
823 (Object[])null);
824 }
825 } catch (Throwable t) {
826 }
827 return Boolean.TRUE;
828 }
829 }
830 );
831
832 if (isPS) {
833 mPSStream.print(" /DeferredMediaSelection true");
834 }
835 mPSStream.println(" >> setpagedevice");
836 }
837 mPSStream.println(PAGE_SAVE);
838 mPSStream.println(paperHeight + COORD_PREP);
839 }
840
841 /**
842 * The RastePrintJob super class calls this method
843 * at the end of each page.
844 */
845 protected void endPage(PageFormat format, Printable painter,
846 int index)
847 throws PrinterException
|
605 double paperWidth = pageFormat.getPaper().getWidth();
606
607 /* PostScript printers can always generate uncollated copies.
608 */
609 mPSStream.print("<< /PageSize [" +
610 paperWidth + " "+ paperHeight+"]");
611
612 final PrintService pservice = getPrintService();
613 Boolean isPS = (Boolean)java.security.AccessController.doPrivileged(
614 new java.security.PrivilegedAction() {
615 public Object run() {
616 try {
617 Class psClass = Class.forName("sun.print.IPPPrintService");
618 if (psClass.isInstance(pservice)) {
619 Method isPSMethod = psClass.getMethod("isPostscript",
620 (Class[])null);
621 return (Boolean)isPSMethod.invoke(pservice, (Object[])null);
622 }
623 } catch (Throwable t) {
624 }
625 return Boolean.FLASE;
626 }
627 }
628 );
629 if (isPS) {
630 mPSStream.print(" /DeferredMediaSelection true");
631 }
632
633 mPSStream.print(" /ImagingBBox null /ManualFeed false");
634 mPSStream.print(isCollated() ? " /Collate true":"");
635 mPSStream.print(" /NumCopies " +getCopiesInt());
636
637 if (sidesAttr != Sides.ONE_SIDED) {
638 if (sidesAttr == Sides.TWO_SIDED_LONG_EDGE) {
639 mPSStream.print(" /Duplex true ");
640 } else if (sidesAttr == Sides.TWO_SIDED_SHORT_EDGE) {
641 mPSStream.print(" /Duplex true /Tumble true ");
642 }
643 }
644 mPSStream.println(" >> setpagedevice ");
645 }
807
808 final PrintService pservice = getPrintService();
809 Boolean isPS =
810 (Boolean)java.security.AccessController.doPrivileged(
811
812 new java.security.PrivilegedAction() {
813 public Object run() {
814 try {
815 Class psClass =
816 Class.forName("sun.print.IPPPrintService");
817 if (psClass.isInstance(pservice)) {
818 Method isPSMethod =
819 psClass.getMethod("isPostscript",
820 (Class[])null);
821 return (Boolean)
822 isPSMethod.invoke(pservice,
823 (Object[])null);
824 }
825 } catch (Throwable t) {
826 }
827 return Boolean.FALSE;
828 }
829 }
830 );
831
832 if (isPS) {
833 mPSStream.print(" /DeferredMediaSelection true");
834 }
835 mPSStream.println(" >> setpagedevice");
836 }
837 mPSStream.println(PAGE_SAVE);
838 mPSStream.println(paperHeight + COORD_PREP);
839 }
840
841 /**
842 * The RastePrintJob super class calls this method
843 * at the end of each page.
844 */
845 protected void endPage(PageFormat format, Printable painter,
846 int index)
847 throws PrinterException
|