Examples of HashPrintRequestAttributeSet


Examples of javax.print.attribute.HashPrintRequestAttributeSet

    private DocFlavor assignDocFlavor() throws Exception {
        return config.getDocFlavor();     
    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
       
        return printRequestAttributeSet;
    }
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

        printService = PrintServiceLookup.lookupDefaultPrintService();
        if (printService == null) {
            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
        printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
        printRequestAttributeSet.add(Sides.ONE_SIDED);
    }
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

      (PrintRequestAttributeSet attributes,
       final MasterReport report)
  {
    if (attributes == null)
    {
      attributes = new HashPrintRequestAttributeSet();
    }

    // for now, be lazy, assume that the first page is the reference
    final PageDefinition pdef = report.getPageDefinition();
    final PageFormat format = pdef.getPageFormat(0);
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

      (PrintRequestAttributeSet attributes,
       final MasterReport report)
  {
    if (attributes == null)
    {
      attributes = new HashPrintRequestAttributeSet();
    }

    if (attributes.containsKey(JobName.class) == false)
    {
      final String jobName = report.getReportConfiguration().getConfigProperty
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

              return Printable.PAGE_EXISTS;
            }
          }
        }, flavor, null);
        DocPrintJob job = service.createPrintJob();
        PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
        job.print(doc, attributes);
        out.close();
      }
    } else {
      // parrt: works with [image/jpeg, image/png, image/x-png, image/vnd.wap.wbmp, image/bmp, image/gif]
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

        }
        */

        DocFlavor docFlavor = DocFlavor.BYTE_ARRAY.PDF;
        Doc myDoc = new SimpleDoc(out.toByteArray(), docFlavor, null);
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(new Copies(1));
        //aset.add(MediaSize.A4);
        aset.add(Sides.ONE_SIDED);

        PrintService[] services = PrintServiceLookup.lookupPrintServices(docFlavor, aset);
        if (services.length > 0) {
            DocPrintJob job = services[0].createPrintJob();
            try {
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

   * no printers were found or an error occurred.
   */
  public static String[] listPrinters(){
    String[] printerNames = new String[0];
    try {
      PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
      DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
      PrintService printService[] =  PrintServiceLookup.lookupPrintServices(flavor, pras);
      printerNames = new String[printService.length];
      for(int i=0;i<printService.length;i++){
        String name = "Error";
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

      String[] pINs, String[] pUKs, String hardTokenSerialPrefix,
      String hardTokenSN, String copyOfHardTokenSN) throws PrinterException{
    if(currentService == null
       || currentPrinterName == null
       || !printerName.equals(currentPrinterName)){
      PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
      DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
      PrintService printService[] =  PrintServiceLookup.lookupPrintServices(flavor, pras);
      int i = 0;
      String trimemdPrinterName = printerName.trim();
      while ( i<printService.length && !trimemdPrinterName.equalsIgnoreCase(printService[i].getName()) ){
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

        ComponentPrintable cp = new ComponentPrintable(imageArea);

        // Graphics g = this.imageArea.getGraphics();
        PageFormat pf = new PageFormat();

        HashPrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();

        PrinterJob job = PrinterJob.getPrinterJob();

        // pf = job.pageDialog(pf);
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

    DocAttributeSet docAttribs   = new HashDocAttributeSet();
    javax.print.Doc doc = new javax.print.SimpleDoc(is, flavor, docAttribs);
   
    try
    {
      PrintRequestAttributeSet printAttributes = new HashPrintRequestAttributeSet();
      job.print(doc, printAttributes);
    }
    catch (PrintException e)
    {
      throw new RuntimeException("print: fail to print the data. Error: " + e.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.