Printer.java

00001 package edu.stanford.hci.r3.printing;
00002 
00003 import java.awt.print.PageFormat;
00004 
00005 import javax.print.PrintService;
00006 
00007 import edu.stanford.hci.r3.units.Points;
00008 import edu.stanford.hci.r3.util.ArrayUtils;
00009 
00018 public class Printer {
00019 
00023         public static void displayPageFormat(PageFormat pageFormat) {
00024                 System.out.println("Page Format {");
00025                 System.out.println("\tPage Width: " + new Points(pageFormat.getWidth()).toInches()
00026                                 + " Height: " + new Points(pageFormat.getHeight()).toInches());
00027                 System.out.println("\tImageable X: " + new Points(pageFormat.getImageableX()).toInches()
00028                                 + " Y: " + new Points(pageFormat.getImageableY()).toInches());
00029                 System.out.println("\tImageable W: "
00030                                 + new Points(pageFormat.getImageableWidth()).toInches() + " H: "
00031                                 + new Points(pageFormat.getImageableHeight()).toInches());
00032                 System.out.print("\tMatrix: ");
00033                 ArrayUtils.printArray(pageFormat.getMatrix());
00034                 System.out.println("} End Page Format");
00035                 System.out.flush();
00036         }
00037 
00038         private PrintService service;
00039 
00040         private boolean showPageSetupDialog = false;
00041 
00042         private boolean showPrintPreferencesDialog = false;
00043 
00049         public Printer(PrintService serv) {
00050                 service = serv;
00051         }
00052 
00056         public double getDPI() {
00057                 // TODO Get real DPI
00058                 System.err.println("Printer :: getDPI currently hardcoded to 600 DPI");
00059                 return 600.0;
00060         }
00061 
00062 }

Generated on Sat Apr 14 18:21:37 2007 for R3 Paper Toolkit by  doxygen 1.4.7