home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / print / RasterPrinterJob.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  24.6 KB  |  1,236 lines

  1. package sun.print;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Frame;
  5. import java.awt.Graphics2D;
  6. import java.awt.GraphicsConfiguration;
  7. import java.awt.GraphicsEnvironment;
  8. import java.awt.HeadlessException;
  9. import java.awt.Rectangle;
  10. import java.awt.Shape;
  11. import java.awt.geom.AffineTransform;
  12. import java.awt.geom.Point2D;
  13. import java.awt.geom.Rectangle2D;
  14. import java.awt.image.BufferedImage;
  15. import java.awt.print.Book;
  16. import java.awt.print.PageFormat;
  17. import java.awt.print.Pageable;
  18. import java.awt.print.Paper;
  19. import java.awt.print.Printable;
  20. import java.awt.print.PrinterAbortException;
  21. import java.awt.print.PrinterException;
  22. import java.awt.print.PrinterJob;
  23. import java.io.File;
  24. import java.io.FilePermission;
  25. import java.io.IOException;
  26. import java.io.OutputStream;
  27. import java.security.AccessController;
  28. import java.util.ArrayList;
  29. import java.util.Locale;
  30. import javax.print.DocFlavor;
  31. import javax.print.DocPrintJob;
  32. import javax.print.PrintException;
  33. import javax.print.PrintService;
  34. import javax.print.PrintServiceLookup;
  35. import javax.print.ServiceUI;
  36. import javax.print.StreamPrintService;
  37. import javax.print.StreamPrintServiceFactory;
  38. import javax.print.DocFlavor.SERVICE_FORMATTED;
  39. import javax.print.attribute.Attribute;
  40. import javax.print.attribute.AttributeSet;
  41. import javax.print.attribute.HashPrintRequestAttributeSet;
  42. import javax.print.attribute.PrintRequestAttributeSet;
  43. import javax.print.attribute.standard.Copies;
  44. import javax.print.attribute.standard.Destination;
  45. import javax.print.attribute.standard.Fidelity;
  46. import javax.print.attribute.standard.JobName;
  47. import javax.print.attribute.standard.JobSheets;
  48. import javax.print.attribute.standard.Media;
  49. import javax.print.attribute.standard.MediaPrintableArea;
  50. import javax.print.attribute.standard.MediaSize;
  51. import javax.print.attribute.standard.MediaSizeName;
  52. import javax.print.attribute.standard.OrientationRequested;
  53. import javax.print.attribute.standard.PageRanges;
  54. import javax.print.attribute.standard.PrinterIsAcceptingJobs;
  55. import javax.print.attribute.standard.PrinterState;
  56. import javax.print.attribute.standard.PrinterStateReason;
  57. import javax.print.attribute.standard.PrinterStateReasons;
  58. import javax.print.attribute.standard.RequestingUserName;
  59. import javax.print.attribute.standard.SheetCollate;
  60. import javax.print.attribute.standard.Sides;
  61. import javax.print.attribute.standard.MediaSize.NA;
  62. import sun.awt.image.ByteInterleavedRaster;
  63. import sun.security.action.GetPropertyAction;
  64.  
  65. public abstract class RasterPrinterJob extends PrinterJob {
  66.    protected static final int PRINTER = 0;
  67.    protected static final int FILE = 1;
  68.    protected static final int STREAM = 2;
  69.    private static final int MAX_BAND_SIZE = 4194304;
  70.    private static final float DPI = 72.0F;
  71.    private static final String FORCE_PIPE_PROP = "sun.java2d.print.pipeline";
  72.    private static final String FORCE_RASTER = "raster";
  73.    private static final String FORCE_PDL = "pdl";
  74.    private static final String SHAPE_TEXT_PROP = "sun.java2d.print.shapetext";
  75.    public static boolean forcePDL = false;
  76.    public static boolean forceRaster = false;
  77.    public static boolean shapeTextProp = false;
  78.    private int cachedBandWidth = 0;
  79.    private int cachedBandHeight = 0;
  80.    private BufferedImage cachedBand = null;
  81.    private int mNumCopies = 1;
  82.    private boolean mCollate = false;
  83.    private int mFirstPage = -1;
  84.    private int mLastPage = -1;
  85.    private Pageable mDocument = new Book();
  86.    private String mDocName = new String("Java Printing");
  87.    private boolean performingPrinting = false;
  88.    private boolean userCancelled = false;
  89.    private FilePermission printToFilePermission;
  90.    private ArrayList redrawList = new ArrayList();
  91.    private int copiesAttr;
  92.    private String jobNameAttr;
  93.    private String userNameAttr;
  94.    private PageRanges pageRangesAttr;
  95.    protected Sides sidesAttr;
  96.    protected String destinationAttr;
  97.    protected boolean noJobSheet = false;
  98.    protected int mDestType = 1;
  99.    protected String mDestination = "";
  100.    protected boolean collateAttReq = false;
  101.    protected boolean landscapeRotates270 = false;
  102.    protected PrintRequestAttributeSet attributes = null;
  103.    protected PrintService myService;
  104.    public static boolean debugPrint;
  105.    private int deviceWidth;
  106.    private int deviceHeight;
  107.    private AffineTransform defaultDeviceTransform;
  108.    private PrinterGraphicsConfig pgConfig;
  109.  
  110.    protected abstract double getXRes();
  111.  
  112.    protected abstract double getYRes();
  113.  
  114.    protected abstract double getPhysicalPrintableX(Paper var1);
  115.  
  116.    protected abstract double getPhysicalPrintableY(Paper var1);
  117.  
  118.    protected abstract double getPhysicalPrintableWidth(Paper var1);
  119.  
  120.    protected abstract double getPhysicalPrintableHeight(Paper var1);
  121.  
  122.    protected abstract double getPhysicalPageWidth(Paper var1);
  123.  
  124.    protected abstract double getPhysicalPageHeight(Paper var1);
  125.  
  126.    protected abstract void startPage(PageFormat var1, Printable var2, int var3) throws PrinterException;
  127.  
  128.    protected abstract void endPage(PageFormat var1, Printable var2, int var3) throws PrinterException;
  129.  
  130.    protected abstract void printBand(byte[] var1, int var2, int var3, int var4, int var5) throws PrinterException;
  131.  
  132.    public void saveState(AffineTransform var1, Shape var2, Rectangle2D var3, double var4, double var6) {
  133.       GraphicsState var8 = new GraphicsState(this, (1)null);
  134.       var8.theTransform = var1;
  135.       var8.theClip = var2;
  136.       var8.region = var3;
  137.       var8.sx = var4;
  138.       var8.sy = var6;
  139.       this.redrawList.add(var8);
  140.    }
  141.  
  142.    protected static PrintService lookupDefaultPrintService() {
  143.       PrintService var0 = PrintServiceLookup.lookupDefaultPrintService();
  144.       if (var0 != null && var0.isDocFlavorSupported(SERVICE_FORMATTED.PAGEABLE) && var0.isDocFlavorSupported(SERVICE_FORMATTED.PRINTABLE)) {
  145.          return var0;
  146.       } else {
  147.          PrintService[] var1 = PrintServiceLookup.lookupPrintServices(SERVICE_FORMATTED.PAGEABLE, (AttributeSet)null);
  148.          return var1.length > 0 ? var1[0] : null;
  149.       }
  150.    }
  151.  
  152.    public PrintService getPrintService() {
  153.       if (this.myService == null) {
  154.          PrintService var1 = PrintServiceLookup.lookupDefaultPrintService();
  155.          if (var1 != null && var1.isDocFlavorSupported(SERVICE_FORMATTED.PAGEABLE)) {
  156.             try {
  157.                this.setPrintService(var1);
  158.                this.myService = var1;
  159.             } catch (PrinterException var5) {
  160.             }
  161.          }
  162.  
  163.          if (this.myService == null) {
  164.             PrintService[] var2 = PrintServiceLookup.lookupPrintServices(SERVICE_FORMATTED.PAGEABLE, (AttributeSet)null);
  165.             if (var2.length > 0) {
  166.                try {
  167.                   this.setPrintService(var2[0]);
  168.                   this.myService = var2[0];
  169.                } catch (PrinterException var4) {
  170.                }
  171.             }
  172.          }
  173.       }
  174.  
  175.       return this.myService;
  176.    }
  177.  
  178.    public void setPrintService(PrintService var1) throws PrinterException {
  179.       if (var1 == null) {
  180.          throw new PrinterException("Service cannot be null");
  181.       } else if (!(var1 instanceof StreamPrintService) && var1.getName() == null) {
  182.          throw new PrinterException("Null PrintService name.");
  183.       } else {
  184.          PrinterState var2 = (PrinterState)var1.getAttribute(PrinterState.class);
  185.          if (var2 == PrinterState.STOPPED) {
  186.             PrinterStateReasons var3 = (PrinterStateReasons)var1.getAttribute(PrinterStateReasons.class);
  187.             if (var3 != null && var3.containsKey(PrinterStateReason.SHUTDOWN)) {
  188.                throw new PrinterException("PrintService is no longer available.");
  189.             }
  190.          }
  191.  
  192.          if (var1.isDocFlavorSupported(SERVICE_FORMATTED.PAGEABLE) && var1.isDocFlavorSupported(SERVICE_FORMATTED.PRINTABLE)) {
  193.             this.myService = var1;
  194.          } else {
  195.             throw new PrinterException("Not a 2D print service: " + var1);
  196.          }
  197.       }
  198.    }
  199.  
  200.    protected void updatePageAttributes(PrintService var1, PageFormat var2) {
  201.       if (var1 != null && var2 != null) {
  202.          float var3 = (float)Math.rint(var2.getPaper().getWidth() * (double)25400.0F / (double)72.0F) / 25400.0F;
  203.          float var4 = (float)Math.rint(var2.getPaper().getHeight() * (double)25400.0F / (double)72.0F) / 25400.0F;
  204.          Media[] var5 = (Media[])var1.getSupportedAttributeValues(Media.class, (DocFlavor)null, (AttributeSet)null);
  205.          Object var6 = null;
  206.  
  207.          try {
  208.             var6 = CustomMediaSizeName.findMedia(var5, var3, var4, 25400);
  209.          } catch (IllegalArgumentException var14) {
  210.          }
  211.  
  212.          if (var6 == null || !var1.isAttributeValueSupported((Attribute)var6, (DocFlavor)null, (AttributeSet)null)) {
  213.             var6 = (Media)var1.getDefaultAttributeValue(Media.class);
  214.          }
  215.  
  216.          OrientationRequested var7;
  217.          switch (var2.getOrientation()) {
  218.             case 0:
  219.                var7 = OrientationRequested.LANDSCAPE;
  220.                break;
  221.             case 2:
  222.                var7 = OrientationRequested.REVERSE_LANDSCAPE;
  223.                break;
  224.             default:
  225.                var7 = OrientationRequested.PORTRAIT;
  226.          }
  227.  
  228.          if (this.attributes == null) {
  229.             this.attributes = new HashPrintRequestAttributeSet();
  230.          }
  231.  
  232.          if (var6 != null) {
  233.             this.attributes.add((Attribute)var6);
  234.          }
  235.  
  236.          this.attributes.add(var7);
  237.          float var8 = (float)(var2.getPaper().getImageableX() / (double)72.0F);
  238.          float var9 = (float)(var2.getPaper().getImageableWidth() / (double)72.0F);
  239.          float var10 = (float)(var2.getPaper().getImageableY() / (double)72.0F);
  240.          float var11 = (float)(var2.getPaper().getImageableHeight() / (double)72.0F);
  241.  
  242.          try {
  243.             this.attributes.add(new MediaPrintableArea(var8, var10, var9, var11, 25400));
  244.          } catch (IllegalArgumentException var13) {
  245.          }
  246.  
  247.       }
  248.    }
  249.  
  250.    public PageFormat pageDialog(PageFormat var1) throws HeadlessException {
  251.       if (GraphicsEnvironment.isHeadless()) {
  252.          throw new HeadlessException();
  253.       } else {
  254.          GraphicsConfiguration var2 = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
  255.          PrintService var3 = (PrintService)AccessController.doPrivileged(new 1(this, var2));
  256.          if (var3 == null) {
  257.             return var1;
  258.          } else {
  259.             this.updatePageAttributes(var3, var1);
  260.             PageFormat var4 = this.pageDialog(this.attributes);
  261.             return var4 == null ? var1 : var4;
  262.          }
  263.       }
  264.    }
  265.  
  266.    public PageFormat pageDialog(PrintRequestAttributeSet var1) throws HeadlessException {
  267.       if (GraphicsEnvironment.isHeadless()) {
  268.          throw new HeadlessException();
  269.       } else {
  270.          GraphicsConfiguration var2 = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
  271.          Rectangle var3 = var2.getBounds();
  272.          int var4 = var3.x + var3.width / 3;
  273.          int var5 = var3.y + var3.height / 3;
  274.          PrintService var6 = (PrintService)AccessController.doPrivileged(new 2(this, var2));
  275.          if (var6 == null) {
  276.             return null;
  277.          } else {
  278.             ServiceDialog var7 = new ServiceDialog(var2, var4, var5, var6, SERVICE_FORMATTED.PAGEABLE, var1, (Frame)null);
  279.             var7.show();
  280.             if (var7.getStatus() == 1) {
  281.                PrintRequestAttributeSet var8 = var7.getAttributes();
  282.                Class var9 = SunAlternateMedia.class;
  283.                if (var1.containsKey(var9) && var8.containsKey(var9)) {
  284.                   var1.remove(var9);
  285.                }
  286.  
  287.                var1.addAll(var8);
  288.                PageFormat var10 = this.defaultPage();
  289.                OrientationRequested var11 = (OrientationRequested)var1.get(OrientationRequested.class);
  290.                byte var12 = 1;
  291.                if (var11 != null) {
  292.                   if (var11 == OrientationRequested.REVERSE_LANDSCAPE) {
  293.                      var12 = 2;
  294.                   } else if (var11 == OrientationRequested.LANDSCAPE) {
  295.                      var12 = 0;
  296.                   }
  297.                }
  298.  
  299.                var10.setOrientation(var12);
  300.                Object var13 = (Media)var1.get(Media.class);
  301.                if (var13 == null) {
  302.                   var13 = (Media)var6.getDefaultAttributeValue(Media.class);
  303.                }
  304.  
  305.                if (!(var13 instanceof MediaSizeName)) {
  306.                   var13 = MediaSizeName.NA_LETTER;
  307.                }
  308.  
  309.                MediaSize var14 = MediaSize.getMediaSizeForName((MediaSizeName)var13);
  310.                if (var14 == null) {
  311.                   var14 = NA.LETTER;
  312.                }
  313.  
  314.                short var15 = 352;
  315.                Paper var16 = new Paper();
  316.                float[] var17 = var14.getSize(var15);
  317.                double var18 = Math.rint((double)var17[0]);
  318.                double var20 = Math.rint((double)var17[1]);
  319.                var16.setSize(var18, var20);
  320.                MediaPrintableArea var22 = (MediaPrintableArea)var1.get(MediaPrintableArea.class);
  321.                double var23;
  322.                double var25;
  323.                double var27;
  324.                double var29;
  325.                if (var22 != null) {
  326.                   var23 = Math.rint((double)(var22.getX(25400) * 72.0F));
  327.                   var27 = Math.rint((double)(var22.getY(25400) * 72.0F));
  328.                   var25 = Math.rint((double)(var22.getWidth(25400) * 72.0F));
  329.                   var29 = Math.rint((double)(var22.getHeight(25400) * 72.0F));
  330.                } else {
  331.                   if (var18 >= (double)432.0F) {
  332.                      var23 = (double)72.0F;
  333.                      var25 = var18 - (double)144.0F;
  334.                   } else {
  335.                      var23 = var18 / (double)6.0F;
  336.                      var25 = var18 * (double)0.75F;
  337.                   }
  338.  
  339.                   if (var20 >= (double)432.0F) {
  340.                      var27 = (double)72.0F;
  341.                      var29 = var20 - (double)144.0F;
  342.                   } else {
  343.                      var27 = var20 / (double)6.0F;
  344.                      var29 = var20 * (double)0.75F;
  345.                   }
  346.                }
  347.  
  348.                var16.setImageableArea(var23, var27, var25, var29);
  349.                var10.setPaper(var16);
  350.                return var10;
  351.             } else {
  352.                return null;
  353.             }
  354.          }
  355.       }
  356.    }
  357.  
  358.    public boolean printDialog(PrintRequestAttributeSet var1) throws HeadlessException {
  359.       if (GraphicsEnvironment.isHeadless()) {
  360.          throw new HeadlessException();
  361.       } else {
  362.          DialogTypeSelection var2 = (DialogTypeSelection)var1.get(DialogTypeSelection.class);
  363.          if (var2 == DialogTypeSelection.NATIVE) {
  364.             this.attributes = var1;
  365.  
  366.             try {
  367.                this.debug_println("calling setAttributes in printDialog");
  368.                this.setAttributes(var1);
  369.             } catch (PrinterException var12) {
  370.             }
  371.  
  372.             boolean var15 = this.printDialog();
  373.             this.attributes = var1;
  374.             return var15;
  375.          } else {
  376.             GraphicsConfiguration var3 = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
  377.             PrintService var4 = (PrintService)AccessController.doPrivileged(new 3(this, var3));
  378.             if (var4 == null) {
  379.                return false;
  380.             } else {
  381.                Object var6 = null;
  382.                Object var5;
  383.                if (var4 instanceof StreamPrintService) {
  384.                   StreamPrintServiceFactory[] var16 = lookupStreamPrintServices((String)null);
  385.                   var5 = new StreamPrintService[var16.length];
  386.  
  387.                   for(int var7 = 0; var7 < var16.length; ++var7) {
  388.                      ((Object[])var5)[var7] = var16[var7].getPrintService((OutputStream)null);
  389.                   }
  390.                } else {
  391.                   var5 = (PrintService[])AccessController.doPrivileged(new 4(this));
  392.                   if (var5 == null || ((Object[])var5).length == 0) {
  393.                      var5 = new PrintService[]{var4};
  394.                   }
  395.                }
  396.  
  397.                Rectangle var17 = var3.getBounds();
  398.                int var8 = var17.x + var17.width / 3;
  399.                int var9 = var17.y + var17.height / 3;
  400.  
  401.                PrintService var10;
  402.                try {
  403.                   var10 = ServiceUI.printDialog(var3, var8, var9, (PrintService[])var5, var4, SERVICE_FORMATTED.PAGEABLE, var1);
  404.                } catch (IllegalArgumentException var14) {
  405.                   var10 = ServiceUI.printDialog(var3, var8, var9, (PrintService[])var5, (PrintService)((Object[])var5)[0], SERVICE_FORMATTED.PAGEABLE, var1);
  406.                }
  407.  
  408.                if (var10 == null) {
  409.                   return false;
  410.                } else {
  411.                   if (!var4.equals(var10)) {
  412.                      try {
  413.                         this.setPrintService(var10);
  414.                      } catch (PrinterException var13) {
  415.                         this.myService = var10;
  416.                      }
  417.                   }
  418.  
  419.                   return true;
  420.                }
  421.             }
  422.          }
  423.       }
  424.    }
  425.  
  426.    public boolean printDialog() throws HeadlessException {
  427.       if (GraphicsEnvironment.isHeadless()) {
  428.          throw new HeadlessException();
  429.       } else {
  430.          HashPrintRequestAttributeSet var1 = new HashPrintRequestAttributeSet();
  431.          var1.add(new Copies(this.getCopies()));
  432.          var1.add(new JobName(this.getJobName(), (Locale)null));
  433.          boolean var2 = this.printDialog(var1);
  434.          if (var2) {
  435.             JobName var3 = (JobName)var1.get(JobName.class);
  436.             if (var3 != null) {
  437.                this.setJobName(var3.getValue());
  438.             }
  439.  
  440.             Copies var4 = (Copies)var1.get(Copies.class);
  441.             if (var4 != null) {
  442.                this.setCopies(var4.getValue());
  443.             }
  444.  
  445.             Destination var5 = (Destination)var1.get(Destination.class);
  446.             if (var5 != null) {
  447.                try {
  448.                   this.mDestType = 1;
  449.                   this.mDestination = (new File(var5.getURI())).getPath();
  450.                } catch (Exception var9) {
  451.                   this.mDestination = "out.prn";
  452.                   PrintService var7 = this.getPrintService();
  453.                   if (var7 != null) {
  454.                      Destination var8 = (Destination)var7.getDefaultAttributeValue(Destination.class);
  455.                      if (var8 != null) {
  456.                         this.mDestination = (new File(var8.getURI())).getPath();
  457.                      }
  458.                   }
  459.                }
  460.             } else {
  461.                this.mDestType = 0;
  462.                PrintService var6 = this.getPrintService();
  463.                if (var6 != null) {
  464.                   this.mDestination = var6.getName();
  465.                }
  466.             }
  467.          }
  468.  
  469.          return var2;
  470.       }
  471.    }
  472.  
  473.    public void setPrintable(Printable var1) {
  474.       this.setPageable(new OpenBook(this.defaultPage(new PageFormat()), var1));
  475.    }
  476.  
  477.    public void setPrintable(Printable var1, PageFormat var2) {
  478.       this.setPageable(new OpenBook(var2, var1));
  479.       this.updatePageAttributes(this.getPrintService(), var2);
  480.    }
  481.  
  482.    public void setPageable(Pageable var1) throws NullPointerException {
  483.       if (var1 != null) {
  484.          this.mDocument = var1;
  485.       } else {
  486.          throw new NullPointerException();
  487.       }
  488.    }
  489.  
  490.    protected void initPrinter() {
  491.    }
  492.  
  493.    protected boolean isSupportedValue(Attribute var1, PrintRequestAttributeSet var2) {
  494.       PrintService var3 = this.getPrintService();
  495.       return var1 != null && var3 != null && var3.isAttributeValueSupported(var1, SERVICE_FORMATTED.PAGEABLE, var2);
  496.    }
  497.  
  498.    protected void setAttributes(PrintRequestAttributeSet var1) throws PrinterException {
  499.       this.setCollated(false);
  500.       this.sidesAttr = null;
  501.       this.pageRangesAttr = null;
  502.       this.copiesAttr = 0;
  503.       this.jobNameAttr = null;
  504.       this.userNameAttr = null;
  505.       this.destinationAttr = null;
  506.       this.collateAttReq = false;
  507.       PrintService var2 = this.getPrintService();
  508.       if (var1 != null && var2 != null) {
  509.          boolean var3 = false;
  510.          Fidelity var4 = (Fidelity)var1.get(Fidelity.class);
  511.          if (var4 != null && var4 == Fidelity.FIDELITY_TRUE) {
  512.             var3 = true;
  513.          }
  514.  
  515.          if (var3) {
  516.             AttributeSet var5 = var2.getUnsupportedAttributes(SERVICE_FORMATTED.PAGEABLE, var1);
  517.             if (var5 != null) {
  518.                throw new PrinterException("Fidelity cannot be satisfied");
  519.             }
  520.          }
  521.  
  522.          SheetCollate var24 = (SheetCollate)var1.get(SheetCollate.class);
  523.          if (this.isSupportedValue(var24, var1)) {
  524.             this.setCollated(var24 == SheetCollate.COLLATED);
  525.          }
  526.  
  527.          this.sidesAttr = (Sides)var1.get(Sides.class);
  528.          if (!this.isSupportedValue(this.sidesAttr, var1)) {
  529.             this.sidesAttr = Sides.ONE_SIDED;
  530.          }
  531.  
  532.          this.pageRangesAttr = (PageRanges)var1.get(PageRanges.class);
  533.          if (!this.isSupportedValue(this.pageRangesAttr, var1)) {
  534.             this.pageRangesAttr = null;
  535.          } else if ((SunPageSelection)var1.get(SunPageSelection.class) == SunPageSelection.RANGE) {
  536.             int[][] var6 = this.pageRangesAttr.getMembers();
  537.             this.setPageRange(var6[0][0] - 1, var6[0][1] - 1);
  538.          }
  539.  
  540.          Copies var25 = (Copies)var1.get(Copies.class);
  541.          if (!this.isSupportedValue(var25, var1) && (var3 || var25 == null)) {
  542.             this.copiesAttr = this.getCopies();
  543.          } else {
  544.             this.copiesAttr = var25.getValue();
  545.             this.setCopies(this.copiesAttr);
  546.          }
  547.  
  548.          Destination var7 = (Destination)var1.get(Destination.class);
  549.          if (this.isSupportedValue(var7, var1)) {
  550.             try {
  551.                this.destinationAttr = "" + new File(var7.getURI().getSchemeSpecificPart());
  552.             } catch (Exception var23) {
  553.                Destination var9 = (Destination)var2.getDefaultAttributeValue(Destination.class);
  554.                if (var9 != null) {
  555.                   this.destinationAttr = "" + new File(var9.getURI().getSchemeSpecificPart());
  556.                }
  557.             }
  558.          }
  559.  
  560.          JobSheets var8 = (JobSheets)var1.get(JobSheets.class);
  561.          if (var8 != null) {
  562.             this.noJobSheet = var8 == JobSheets.NONE;
  563.          }
  564.  
  565.          JobName var26 = (JobName)var1.get(JobName.class);
  566.          if (!this.isSupportedValue(var26, var1) && (var3 || var26 == null)) {
  567.             this.jobNameAttr = this.getJobName();
  568.          } else {
  569.             this.jobNameAttr = var26.getValue();
  570.             this.setJobName(this.jobNameAttr);
  571.          }
  572.  
  573.          RequestingUserName var10 = (RequestingUserName)var1.get(RequestingUserName.class);
  574.          if (!this.isSupportedValue(var10, var1) && (var3 || var10 == null)) {
  575.             try {
  576.                this.userNameAttr = this.getUserName();
  577.             } catch (SecurityException var22) {
  578.                this.userNameAttr = "";
  579.             }
  580.          } else {
  581.             this.userNameAttr = var10.getValue();
  582.          }
  583.  
  584.          Media var11 = (Media)var1.get(Media.class);
  585.          OrientationRequested var12 = (OrientationRequested)var1.get(OrientationRequested.class);
  586.          MediaPrintableArea var13 = (MediaPrintableArea)var1.get(MediaPrintableArea.class);
  587.          if ((var12 != null || var11 != null || var13 != null) && this.getPageable() instanceof OpenBook) {
  588.             Pageable var14 = this.getPageable();
  589.             Printable var15 = var14.getPrintable(0);
  590.             PageFormat var16 = (PageFormat)var14.getPageFormat(0).clone();
  591.             Paper var17 = var16.getPaper();
  592.             if (var13 == null && var11 != null && var2.isAttributeCategorySupported(MediaPrintableArea.class)) {
  593.                Object var18 = var2.getSupportedAttributeValues(MediaPrintableArea.class, (DocFlavor)null, var1);
  594.                if (var18 instanceof MediaPrintableArea[] && ((MediaPrintableArea[])((MediaPrintableArea[])var18)).length > 0) {
  595.                   var13 = ((MediaPrintableArea[])((MediaPrintableArea[])var18))[0];
  596.                }
  597.             }
  598.  
  599.             if (this.isSupportedValue(var12, var1) || !var3 && var12 != null) {
  600.                byte var28;
  601.                if (var12.equals(OrientationRequested.REVERSE_LANDSCAPE)) {
  602.                   var28 = 2;
  603.                } else if (var12.equals(OrientationRequested.LANDSCAPE)) {
  604.                   var28 = 0;
  605.                } else {
  606.                   var28 = 1;
  607.                }
  608.  
  609.                var16.setOrientation(var28);
  610.             }
  611.  
  612.             if ((this.isSupportedValue(var11, var1) || !var3 && var11 != null) && var11 instanceof MediaSizeName) {
  613.                MediaSizeName var29 = (MediaSizeName)var11;
  614.                MediaSize var19 = MediaSize.getMediaSizeForName(var29);
  615.                if (var19 != null) {
  616.                   float var20 = var19.getX(25400) * 72.0F;
  617.                   float var21 = var19.getY(25400) * 72.0F;
  618.                   var17.setSize((double)var20, (double)var21);
  619.                   if (var13 == null) {
  620.                      var17.setImageableArea((double)72.0F, (double)72.0F, (double)var20 - (double)144.0F, (double)var21 - (double)144.0F);
  621.                   }
  622.                }
  623.             }
  624.  
  625.             if (this.isSupportedValue(var13, var1) || !var3 && var13 != null) {
  626.                float[] var30 = var13.getPrintableArea(25400);
  627.  
  628.                for(int var31 = 0; var31 < var30.length; ++var31) {
  629.                   var30[var31] *= 72.0F;
  630.                }
  631.  
  632.                var17.setImageableArea((double)var30[0], (double)var30[1], (double)var30[2], (double)var30[3]);
  633.             }
  634.  
  635.             var16.setPaper(var17);
  636.             var16 = this.validatePage(var16);
  637.             this.setPrintable(var15, var16);
  638.          } else {
  639.             this.attributes = var1;
  640.          }
  641.  
  642.       }
  643.    }
  644.  
  645.    private void spoolToService(PrintService var1, PrintRequestAttributeSet var2) throws PrinterException {
  646.       if (var1 == null) {
  647.          throw new PrinterException("No print service found.");
  648.       } else {
  649.          DocPrintJob var3 = var1.createPrintJob();
  650.          PageableDoc var4 = new PageableDoc(this.getPageable());
  651.          if (var2 == null) {
  652.             var2 = new HashPrintRequestAttributeSet();
  653.          }
  654.  
  655.          try {
  656.             var3.print(var4, (PrintRequestAttributeSet)var2);
  657.          } catch (PrintException var6) {
  658.             throw new PrinterException(var6.toString());
  659.          }
  660.       }
  661.    }
  662.  
  663.    public void print() throws PrinterException {
  664.       this.print(this.attributes);
  665.    }
  666.  
  667.    protected void debug_println(String var1) {
  668.       if (debugPrint) {
  669.          System.out.println("RasterPrinterJob " + var1 + " " + this);
  670.       }
  671.  
  672.    }
  673.  
  674.    public void print(PrintRequestAttributeSet var1) throws PrinterException {
  675.       PrintService var2 = this.getPrintService();
  676.       this.debug_println("psvc = " + var2);
  677.       if (var2 == null) {
  678.          throw new PrinterException("No print service found.");
  679.       } else {
  680.          PrinterState var3 = (PrinterState)var2.getAttribute(PrinterState.class);
  681.          if (var3 == PrinterState.STOPPED) {
  682.             PrinterStateReasons var4 = (PrinterStateReasons)var2.getAttribute(PrinterStateReasons.class);
  683.             if (var4 != null && var4.containsKey(PrinterStateReason.SHUTDOWN)) {
  684.                throw new PrinterException("PrintService is no longer available.");
  685.             }
  686.          }
  687.  
  688.          if ((PrinterIsAcceptingJobs)var2.getAttribute(PrinterIsAcceptingJobs.class) == PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS) {
  689.             throw new PrinterException("Printer is not accepting job.");
  690.          } else if (var2 instanceof SunPrinterJobService && ((SunPrinterJobService)var2).usesClass(this.getClass())) {
  691.             this.setAttributes(var1);
  692.             if (this.destinationAttr != null) {
  693.                File var29 = new File(this.destinationAttr);
  694.  
  695.                try {
  696.                   if (var29.createNewFile()) {
  697.                      var29.delete();
  698.                   }
  699.                } catch (IOException var26) {
  700.                   throw new PrinterException("Cannot write to file:" + this.destinationAttr);
  701.                } catch (SecurityException var27) {
  702.                }
  703.  
  704.                File var5 = var29.getParentFile();
  705.                if (var29.exists() && (!var29.isFile() || !var29.canWrite()) || var5 != null && (!var5.exists() || var5.exists() && !var5.canWrite())) {
  706.                   throw new PrinterException("Cannot write to file:" + this.destinationAttr);
  707.                }
  708.             }
  709.  
  710.             this.initPrinter();
  711.             int var30 = this.getCollatedCopies();
  712.             int var31 = this.getNoncollatedCopies();
  713.             this.debug_println("getCollatedCopies()  " + var30 + " getNoncollatedCopies() " + var31);
  714.             int var6 = this.mDocument.getNumberOfPages();
  715.             if (var6 != 0) {
  716.                int var7 = this.getFirstPage();
  717.                int var8 = this.getLastPage();
  718.                if (var8 == -1) {
  719.                   int var9 = this.mDocument.getNumberOfPages();
  720.                   if (var9 != -1) {
  721.                      var8 = this.mDocument.getNumberOfPages() - 1;
  722.                   }
  723.                }
  724.  
  725.                try {
  726.                   synchronized(this) {
  727.                      this.performingPrinting = true;
  728.                      this.userCancelled = false;
  729.                   }
  730.  
  731.                   this.startDoc();
  732.                   if (this.isCancelled()) {
  733.                      this.cancelDoc();
  734.                   }
  735.  
  736.                   boolean var32 = true;
  737.                   if (var1 != null) {
  738.                      SunPageSelection var10 = (SunPageSelection)var1.get(SunPageSelection.class);
  739.                      if (var10 != null && var10 != SunPageSelection.RANGE) {
  740.                         var32 = false;
  741.                      }
  742.                   }
  743.  
  744.                   this.debug_println("after startDoc rangeSelected? " + var32 + " numNonCollatedCopies " + var31);
  745.  
  746.                   for(int var33 = 0; var33 < var30; ++var33) {
  747.                      int var11 = var7;
  748.  
  749.                      for(int var12 = 0; (var11 <= var8 || var8 == -1) && var12 == 0; ++var11) {
  750.                         if (this.pageRangesAttr != null && var32) {
  751.                            int var13 = this.pageRangesAttr.next(var11);
  752.                            if (var13 == -1) {
  753.                               break;
  754.                            }
  755.  
  756.                            if (var13 != var11 + 1) {
  757.                               continue;
  758.                            }
  759.                         }
  760.  
  761.                         for(int var34 = 0; var34 < var31 && var12 == 0; ++var34) {
  762.                            if (this.isCancelled()) {
  763.                               this.cancelDoc();
  764.                            }
  765.  
  766.                            this.debug_println("printPage " + var11);
  767.                            var12 = this.printPage(this.mDocument, var11);
  768.                         }
  769.                      }
  770.                   }
  771.  
  772.                   if (this.isCancelled()) {
  773.                      this.cancelDoc();
  774.                   }
  775.                } finally {
  776.                   synchronized(this) {
  777.                      if (this.performingPrinting) {
  778.                         this.endDoc();
  779.                      }
  780.  
  781.                      this.performingPrinting = false;
  782.                      this.notify();
  783.                   }
  784.                }
  785.  
  786.             }
  787.          } else {
  788.             this.spoolToService(var2, var1);
  789.          }
  790.       }
  791.    }
  792.  
  793.    protected void validatePaper(Paper var1, Paper var2) {
  794.       if (var1 != null && var2 != null) {
  795.          double var3 = var1.getWidth();
  796.          double var5 = var1.getHeight();
  797.          double var7 = var1.getImageableX();
  798.          double var9 = var1.getImageableY();
  799.          double var11 = var1.getImageableWidth();
  800.          double var13 = var1.getImageableHeight();
  801.          Paper var15 = new Paper();
  802.          var3 = var3 > (double)0.0F ? var3 : var15.getWidth();
  803.          var5 = var5 > (double)0.0F ? var5 : var15.getHeight();
  804.          var7 = var7 > (double)0.0F ? var7 : var15.getImageableX();
  805.          var9 = var9 > (double)0.0F ? var9 : var15.getImageableY();
  806.          var11 = var11 > (double)0.0F ? var11 : var15.getImageableWidth();
  807.          var13 = var13 > (double)0.0F ? var13 : var15.getImageableHeight();
  808.          if (var11 > var3) {
  809.             var11 = var3;
  810.          }
  811.  
  812.          if (var13 > var5) {
  813.             var13 = var5;
  814.          }
  815.  
  816.          if (var7 + var11 > var3) {
  817.             var7 = var3 - var11;
  818.          }
  819.  
  820.          if (var9 + var13 > var5) {
  821.             var9 = var5 - var13;
  822.          }
  823.  
  824.          var2.setSize(var3, var5);
  825.          var2.setImageableArea(var7, var9, var11, var13);
  826.       }
  827.    }
  828.  
  829.    public PageFormat defaultPage(PageFormat var1) {
  830.       PageFormat var2 = (PageFormat)var1.clone();
  831.       var2.setOrientation(1);
  832.       Paper var3 = new Paper();
  833.       double var4 = (double)72.0F;
  834.       Object var10 = null;
  835.       PrintService var11 = this.getPrintService();
  836.       if (var11 != null) {
  837.          Media var17 = (Media)var11.getDefaultAttributeValue(Media.class);
  838.          MediaSize var12;
  839.          if (var17 instanceof MediaSizeName && (var12 = MediaSize.getMediaSizeForName((MediaSizeName)var17)) != null) {
  840.             double var15 = (double)var12.getX(25400) * var4;
  841.             double var16 = (double)var12.getY(25400) * var4;
  842.             var3.setSize(var15, var16);
  843.             var3.setImageableArea(var4, var4, var15 - (double)2.0F * var4, var16 - (double)2.0F * var4);
  844.             var2.setPaper(var3);
  845.             return var2;
  846.          }
  847.       }
  848.  
  849.       String var18 = Locale.getDefault().getCountry();
  850.       if (!Locale.getDefault().equals(Locale.ENGLISH) && var18 != null && !var18.equals(Locale.US.getCountry()) && !var18.equals(Locale.CANADA.getCountry())) {
  851.          double var13 = 25.4;
  852.          double var6 = Math.rint((double)210.0F * var4 / var13);
  853.          double var8 = Math.rint((double)297.0F * var4 / var13);
  854.          var3.setSize(var6, var8);
  855.          var3.setImageableArea(var4, var4, var6 - (double)2.0F * var4, var8 - (double)2.0F * var4);
  856.       }
  857.  
  858.       var2.setPaper(var3);
  859.       return var2;
  860.    }
  861.  
  862.    public PageFormat validatePage(PageFormat var1) {
  863.       PageFormat var2 = (PageFormat)var1.clone();
  864.       Paper var3 = new Paper();
  865.       this.validatePaper(var2.getPaper(), var3);
  866.       var2.setPaper(var3);
  867.       return var2;
  868.    }
  869.  
  870.    public void setCopies(int var1) {
  871.       this.mNumCopies = var1;
  872.    }
  873.  
  874.    public int getCopies() {
  875.       return this.mNumCopies;
  876.    }
  877.  
  878.    protected int getCopiesInt() {
  879.       return this.copiesAttr > 0 ? this.copiesAttr : this.getCopies();
  880.    }
  881.  
  882.    public String getUserName() {
  883.       return System.getProperty("user.name");
  884.    }
  885.  
  886.    protected String getUserNameInt() {
  887.       if (this.userNameAttr != null) {
  888.          return this.userNameAttr;
  889.       } else {
  890.          try {
  891.             return this.getUserName();
  892.          } catch (SecurityException var2) {
  893.             return "";
  894.          }
  895.       }
  896.    }
  897.  
  898.    public void setJobName(String var1) {
  899.       if (var1 != null) {
  900.          this.mDocName = var1;
  901.       } else {
  902.          throw new NullPointerException();
  903.       }
  904.    }
  905.  
  906.    public String getJobName() {
  907.       return this.mDocName;
  908.    }
  909.  
  910.    protected String getJobNameInt() {
  911.       return this.jobNameAttr != null ? this.jobNameAttr : this.getJobName();
  912.    }
  913.  
  914.    protected void setPageRange(int var1, int var2) {
  915.       if (var1 >= 0 && var2 >= 0) {
  916.          this.mFirstPage = var1;
  917.          this.mLastPage = var2;
  918.          if (this.mLastPage < this.mFirstPage) {
  919.             this.mLastPage = this.mFirstPage;
  920.          }
  921.       } else {
  922.          this.mFirstPage = -1;
  923.          this.mLastPage = -1;
  924.       }
  925.  
  926.    }
  927.  
  928.    protected int getFirstPage() {
  929.       return this.mFirstPage == -1 ? 0 : this.mFirstPage;
  930.    }
  931.  
  932.    protected int getLastPage() {
  933.       return this.mLastPage;
  934.    }
  935.  
  936.    protected void setCollated(boolean var1) {
  937.       this.mCollate = var1;
  938.       this.collateAttReq = true;
  939.    }
  940.  
  941.    protected boolean isCollated() {
  942.       return this.mCollate;
  943.    }
  944.  
  945.    protected abstract void startDoc() throws PrinterException;
  946.  
  947.    protected abstract void endDoc() throws PrinterException;
  948.  
  949.    protected abstract void abortDoc();
  950.  
  951.    private void cancelDoc() throws PrinterAbortException {
  952.       this.abortDoc();
  953.       synchronized(this) {
  954.          this.userCancelled = false;
  955.          this.performingPrinting = false;
  956.          this.notify();
  957.       }
  958.  
  959.       throw new PrinterAbortException();
  960.    }
  961.  
  962.    protected int getCollatedCopies() {
  963.       return this.isCollated() ? this.getCopiesInt() : 1;
  964.    }
  965.  
  966.    protected int getNoncollatedCopies() {
  967.       return this.isCollated() ? 1 : this.getCopiesInt();
  968.    }
  969.  
  970.    synchronized void setGraphicsConfigInfo(AffineTransform var1, double var2, double var4) {
  971.       Point2D.Double var6 = new Point2D.Double(var2, var4);
  972.       var1.transform(var6, var6);
  973.       if (this.pgConfig == null || this.defaultDeviceTransform == null || !var1.equals(this.defaultDeviceTransform) || this.deviceWidth != (int)var6.getX() || this.deviceHeight != (int)var6.getY()) {
  974.          this.deviceWidth = (int)var6.getX();
  975.          this.deviceHeight = (int)var6.getY();
  976.          this.defaultDeviceTransform = var1;
  977.          this.pgConfig = null;
  978.       }
  979.  
  980.    }
  981.  
  982.    synchronized PrinterGraphicsConfig getPrinterGraphicsConfig() {
  983.       if (this.pgConfig != null) {
  984.          return this.pgConfig;
  985.       } else {
  986.          String var1 = "Printer Device";
  987.          PrintService var2 = this.getPrintService();
  988.          if (var2 != null) {
  989.             var1 = var2.toString();
  990.          }
  991.  
  992.          this.pgConfig = new PrinterGraphicsConfig(var1, this.defaultDeviceTransform, this.deviceWidth, this.deviceHeight);
  993.          return this.pgConfig;
  994.       }
  995.    }
  996.  
  997.    protected int printPage(Pageable var1, int var2) throws PrinterException {
  998.       PageFormat var3;
  999.       PageFormat var4;
  1000.       Printable var5;
  1001.       try {
  1002.          var4 = var1.getPageFormat(var2);
  1003.          var3 = (PageFormat)var4.clone();
  1004.          var5 = var1.getPrintable(var2);
  1005.       } catch (Exception var40) {
  1006.          throw new PrinterException("No page or printable exists.");
  1007.       }
  1008.  
  1009.       Paper var6 = var3.getPaper();
  1010.       if (var3.getOrientation() != 1 && this.landscapeRotates270) {
  1011.          double var7 = var6.getImageableX();
  1012.          double var9 = var6.getImageableY();
  1013.          double var11 = var6.getImageableWidth();
  1014.          double var13 = var6.getImageableHeight();
  1015.          var6.setImageableArea(var6.getWidth() - var7 - var11, var6.getHeight() - var9 - var13, var11, var13);
  1016.          var3.setPaper(var6);
  1017.          if (var3.getOrientation() == 0) {
  1018.             var3.setOrientation(2);
  1019.          } else {
  1020.             var3.setOrientation(0);
  1021.          }
  1022.       }
  1023.  
  1024.       double var41 = this.getXRes() / (double)72.0F;
  1025.       double var42 = this.getYRes() / (double)72.0F;
  1026.       Rectangle2D.Double var43 = new Rectangle2D.Double(var6.getImageableX() * var41, var6.getImageableY() * var42, var6.getImageableWidth() * var41, var6.getImageableHeight() * var42);
  1027.       AffineTransform var12 = new AffineTransform();
  1028.       AffineTransform var44 = new AffineTransform();
  1029.       var44.scale(var41, var42);
  1030.       int var14 = (int)((Rectangle2D)var43).getWidth();
  1031.       if (var14 % 4 != 0) {
  1032.          var14 += 4 - var14 % 4;
  1033.       }
  1034.  
  1035.       if (var14 <= 0) {
  1036.          throw new PrinterException("Paper's imageable width is too small.");
  1037.       } else {
  1038.          int var15 = (int)((Rectangle2D)var43).getHeight();
  1039.          if (var15 <= 0) {
  1040.             throw new PrinterException("Paper's imageable height is too small.");
  1041.          } else {
  1042.             int var16 = 4194304 / var14 / 3;
  1043.             int var17 = (int)Math.rint(var6.getImageableX() * var41);
  1044.             int var18 = (int)Math.rint(var6.getImageableY() * var42);
  1045.             AffineTransform var19 = new AffineTransform();
  1046.             var19.translate((double)(-var17), (double)var18);
  1047.             var19.translate((double)0.0F, (double)var16);
  1048.             var19.scale((double)1.0F, (double)-1.0F);
  1049.             BufferedImage var20 = new BufferedImage(1, 1, 5);
  1050.             PeekGraphics var21 = this.createPeekGraphics(var20.createGraphics(), this);
  1051.             Rectangle2D.Double var22 = new Rectangle2D.Double(var3.getImageableX(), var3.getImageableY(), var3.getImageableWidth(), var3.getImageableHeight());
  1052.             var21.transform(var44);
  1053.             var21.translate(-this.getPhysicalPrintableX(var6) / var41, -this.getPhysicalPrintableY(var6) / var42);
  1054.             var21.transform(new AffineTransform(var3.getMatrix()));
  1055.             this.initPrinterGraphics(var21, var22);
  1056.             AffineTransform var23 = var21.getTransform();
  1057.             this.setGraphicsConfigInfo(var44, var6.getWidth(), var6.getHeight());
  1058.             int var24 = var5.print(var21, var4, var2);
  1059.             this.debug_println("pageResult " + var24);
  1060.             if (var24 == 0) {
  1061.                this.debug_println("startPage " + var2);
  1062.                this.startPage(var3, var5, var2);
  1063.                Graphics2D var25 = this.createPathGraphics(var21, this, var5, var3, var2);
  1064.                if (var25 != null) {
  1065.                   var25.transform(var44);
  1066.                   var25.translate(-this.getPhysicalPrintableX(var6) / var41, -this.getPhysicalPrintableY(var6) / var42);
  1067.                   var25.transform(new AffineTransform(var3.getMatrix()));
  1068.                   this.initPrinterGraphics(var25, var22);
  1069.                   this.redrawList.clear();
  1070.                   AffineTransform var45 = var25.getTransform();
  1071.                   var5.print(var25, var4, var2);
  1072.  
  1073.                   for(int var46 = 0; var46 < this.redrawList.size(); ++var46) {
  1074.                      GraphicsState var47 = (GraphicsState)this.redrawList.get(var46);
  1075.                      var25.setTransform(var45);
  1076.                      ((PathGraphics)var25).redrawRegion(var47.region, var47.sx, var47.sy, var47.theClip, var47.theTransform);
  1077.                   }
  1078.                } else {
  1079.                   BufferedImage var26 = this.cachedBand;
  1080.                   if (this.cachedBand == null || var14 != this.cachedBandWidth || var16 != this.cachedBandHeight) {
  1081.                      var26 = new BufferedImage(var14, var16, 5);
  1082.                      this.cachedBand = var26;
  1083.                      this.cachedBandWidth = var14;
  1084.                      this.cachedBandHeight = var16;
  1085.                   }
  1086.  
  1087.                   Graphics2D var27 = var26.createGraphics();
  1088.                   Rectangle2D.Double var28 = new Rectangle2D.Double((double)0.0F, (double)0.0F, (double)var14, (double)var16);
  1089.                   this.initPrinterGraphics(var27, var28);
  1090.                   ProxyGraphics2D var29 = new ProxyGraphics2D(var27, this);
  1091.                   Graphics2D var30 = var26.createGraphics();
  1092.                   var30.setColor(Color.white);
  1093.                   ByteInterleavedRaster var31 = (ByteInterleavedRaster)var26.getRaster();
  1094.                   byte[] var32 = var31.getDataStorage();
  1095.                   int var10000 = var18 + var15;
  1096.                   int var34 = (int)this.getPhysicalPrintableX(var6);
  1097.                   int var35 = (int)this.getPhysicalPrintableY(var6);
  1098.  
  1099.                   for(int var36 = 0; var36 <= var15; var36 += var16) {
  1100.                      var30.fillRect(0, 0, var14, var16);
  1101.                      var27.setTransform(var12);
  1102.                      var27.transform(var19);
  1103.                      var19.translate((double)0.0F, (double)(-var16));
  1104.                      var27.transform(var44);
  1105.                      var27.transform(new AffineTransform(var3.getMatrix()));
  1106.                      Rectangle var37 = var27.getClipBounds();
  1107.                      var37 = var23.createTransformedShape(var37).getBounds();
  1108.                      if (var37 == null || var21.hitsDrawingArea(var37) && var14 > 0 && var16 > 0) {
  1109.                         int var38 = var17 - var34;
  1110.                         if (var38 < 0) {
  1111.                            var27.translate((double)var38 / var41, (double)0.0F);
  1112.                            var38 = 0;
  1113.                         }
  1114.  
  1115.                         int var39 = var18 + var36 - var35;
  1116.                         if (var39 < 0) {
  1117.                            var27.translate((double)0.0F, (double)var39 / var42);
  1118.                            var39 = 0;
  1119.                         }
  1120.  
  1121.                         var29.setDelegate((Graphics2D)var27.create());
  1122.                         var5.print(var29, var4, var2);
  1123.                         var29.dispose();
  1124.                         this.printBand(var32, var38, var39, var14, var16);
  1125.                      }
  1126.                   }
  1127.  
  1128.                   var30.dispose();
  1129.                   var27.dispose();
  1130.                }
  1131.  
  1132.                this.debug_println("calling endPage " + var2);
  1133.                this.endPage(var3, var5, var2);
  1134.             }
  1135.  
  1136.             return var24;
  1137.          }
  1138.       }
  1139.    }
  1140.  
  1141.    public void cancel() {
  1142.       synchronized(this) {
  1143.          if (this.performingPrinting) {
  1144.             this.userCancelled = true;
  1145.          }
  1146.  
  1147.          this.notify();
  1148.       }
  1149.    }
  1150.  
  1151.    public boolean isCancelled() {
  1152.       boolean var1 = false;
  1153.       synchronized(this) {
  1154.          var1 = this.performingPrinting && this.userCancelled;
  1155.          this.notify();
  1156.          return var1;
  1157.       }
  1158.    }
  1159.  
  1160.    protected Pageable getPageable() {
  1161.       return this.mDocument;
  1162.    }
  1163.  
  1164.    protected Graphics2D createPathGraphics(PeekGraphics var1, PrinterJob var2, Printable var3, PageFormat var4, int var5) {
  1165.       return null;
  1166.    }
  1167.  
  1168.    protected PeekGraphics createPeekGraphics(Graphics2D var1, PrinterJob var2) {
  1169.       return new PeekGraphics(var1, var2);
  1170.    }
  1171.  
  1172.    void initPrinterGraphics(Graphics2D var1, Rectangle2D var2) {
  1173.       var1.setClip(var2);
  1174.       var1.setPaint(Color.black);
  1175.    }
  1176.  
  1177.    public boolean checkAllowedToPrintToFile() {
  1178.       try {
  1179.          this.throwPrintToFile();
  1180.          return true;
  1181.       } catch (SecurityException var2) {
  1182.          return false;
  1183.       }
  1184.    }
  1185.  
  1186.    private void throwPrintToFile() {
  1187.       SecurityManager var1 = System.getSecurityManager();
  1188.       if (var1 != null) {
  1189.          if (this.printToFilePermission == null) {
  1190.             this.printToFilePermission = new FilePermission("<<ALL FILES>>", "read,write");
  1191.          }
  1192.  
  1193.          var1.checkPermission(this.printToFilePermission);
  1194.       }
  1195.  
  1196.    }
  1197.  
  1198.    protected String removeControlChars(String var1) {
  1199.       char[] var2 = var1.toCharArray();
  1200.       int var3 = var2.length;
  1201.       char[] var4 = new char[var3];
  1202.       int var5 = 0;
  1203.  
  1204.       for(int var6 = 0; var6 < var3; ++var6) {
  1205.          char var7 = var2[var6];
  1206.          if (var7 > '\r' || var7 < '\t' || var7 == 11 || var7 == '\f') {
  1207.             var4[var5++] = var7;
  1208.          }
  1209.       }
  1210.  
  1211.       if (var5 == var3) {
  1212.          return var1;
  1213.       } else {
  1214.          return new String(var4, 0, var5);
  1215.       }
  1216.    }
  1217.  
  1218.    static {
  1219.       String var0 = (String)AccessController.doPrivileged(new GetPropertyAction("sun.java2d.print.pipeline"));
  1220.       if (var0 != null) {
  1221.          if (var0.equalsIgnoreCase("pdl")) {
  1222.             forcePDL = true;
  1223.          } else if (var0.equalsIgnoreCase("raster")) {
  1224.             forceRaster = true;
  1225.          }
  1226.       }
  1227.  
  1228.       String var1 = (String)AccessController.doPrivileged(new GetPropertyAction("sun.java2d.print.shapetext"));
  1229.       if (var1 != null) {
  1230.          shapeTextProp = true;
  1231.       }
  1232.  
  1233.       debugPrint = false;
  1234.    }
  1235. }
  1236.