Package javax.print

Examples of javax.print.StreamPrintService


      }catch(IOException  e){
        throw new PrintException("cannotExport", e);
      }
      break;
    case PRINTER_FILE_MODE:
      StreamPrintService psPrinter = null;
      String psMimeType = "application/postscript";
      StreamPrintServiceFactory[] factories =
        PrinterJob.lookupStreamPrintServices(psMimeType);
      if (factories.length<1) {
        throw new PrintException("noPSService", null);
      }
      FileOutputStream fos = null;
      try {
        // Get a full path for destination file
        dest = new File(dest).getCanonicalPath();
       
        fos = new FileOutputStream(dest);
        psPrinter = factories[0].getPrintService(fos);
      } catch (Exception e) {
        throw new PrintException("cannotPrintToFile", e);
      }
      printPrinter(psPrinter, comp);
      psPrinter.dispose();
      try {
        fos.close();
      } catch (Exception e2) {
        throw new PrintException("cannotPrintToFile", e2);
      }
View Full Code Here


        log.log(Level.SEVERE, "(fos) - No StreamPrintService");
        return false;
      }
      //  just use first one - sun.print.PSStreamPrinterFactory
      //  System.out.println("- " + spsfactories[0]);
      StreamPrintService sps = spsfactories[0].getPrintService(os);
      //  get format
      if (m_layout == null)
        layout();
      //  print it
      sps.createPrintJob().print(m_layout.getPageable(false),
        new HashPrintRequestAttributeSet());
      //
      os.flush();
      //following 2 line for backward compatibility
      if (os instanceof FileOutputStream)
View Full Code Here

        OutputStream output;

        if (epsPrinter == null) {
            if (getPrintService() instanceof PSStreamPrintService) {
                StreamPrintService sps = (StreamPrintService)getPrintService();
                mDestType = RasterPrinterJob.STREAM;
                if (sps.isDisposed()) {
                    throw new PrinterException("service is disposed");
                }
                output = sps.getOutputStream();
                if (output == null) {
                    throw new PrinterException("Null output stream");
                }
            } else {
                /* REMIND: This needs to be more maintainable */
 
View Full Code Here

        for (int i = 0; i < clientFlavors.length; i++) {
            StreamPrintServiceFactory[] factories = StreamPrintServiceFactory
                    .lookupStreamPrintServiceFactories(flavor, clientFlavors[i]
                            .getMimeType());
            for (int j = 0; j < factories.length; j++) {
                StreamPrintService sps = factories[j]
                        .getPrintService(new ByteArrayOutputStream());
                if (sps != null) {
                    try {
                        sps.getOutputStream().close();
                    } catch (IOException e) {
                        // just ignore
                    }
                    sps.dispose();
                    //return sps.getSupportedAttributeValues(category,
                    //        flavor, attributes);
                    return client.getSupportedAttributeValues(category,
                            clientFlavors[i], attributes);
                }
View Full Code Here

        for (int i = 0; i < clientFlavors.length; i++) {
            StreamPrintServiceFactory[] factories = StreamPrintServiceFactory
                    .lookupStreamPrintServiceFactories(flavor, clientFlavors[i]
                            .getMimeType());
            for (int j = 0; j < factories.length; j++) {
                StreamPrintService sps = factories[j]
                        .getPrintService(new ByteArrayOutputStream());
                if (sps != null) {
                    try {
                        sps.getOutputStream().close();
                    } catch (IOException e) {
                        // just ignore
                    }
                    sps.dispose();
                    //return sps.isAttributeValueSupported(attrval, flavor, attributes);
                    return client.isAttributeValueSupported(attrval,
                            clientFlavors[i], attributes);
                }
            }
View Full Code Here

                        break;
                    }
                }

                if (spsf != null) {
                    StreamPrintService sps = spsf.getPrintService(spsOutStream);

                    /*
                     * Constructing new Doc object for client: - connecting
                     * InputStream of client with OutputStream of
                     * StreamPrintSrevice - constructing DocFlavor for
View Full Code Here

                        break;
                    }
                }

                if (spsf != null) {
                    StreamPrintService sps = spsf.getPrintService(spsOutStream);

                    /*
                     * Constructing new Doc object for client: - connecting
                     * InputStream of client with OutputStream of
                     * StreamPrintSrevice - constructing DocFlavor for
View Full Code Here

        for (int i = 0; i < clientFlavors.length; i++) {
            StreamPrintServiceFactory[] factories = StreamPrintServiceFactory
                    .lookupStreamPrintServiceFactories(flavor, clientFlavors[i]
                            .getMimeType());
            for (int j = 0; j < factories.length; j++) {
                StreamPrintService sps = factories[j]
                        .getPrintService(new ByteArrayOutputStream());
                if (sps != null) {
                    try {
                        sps.getOutputStream().close();
                    } catch (IOException e) {
                        // just ignore
                    }
                    sps.dispose();
                    //return sps.getSupportedAttributeValues(category,
                    //        flavor, attributes);
                    return client.getSupportedAttributeValues(category,
                            clientFlavors[i], attributes);
                }
View Full Code Here

        for (int i = 0; i < clientFlavors.length; i++) {
            StreamPrintServiceFactory[] factories = StreamPrintServiceFactory
                    .lookupStreamPrintServiceFactories(flavor, clientFlavors[i]
                            .getMimeType());
            for (int j = 0; j < factories.length; j++) {
                StreamPrintService sps = factories[j]
                        .getPrintService(new ByteArrayOutputStream());
                if (sps != null) {
                    try {
                        sps.getOutputStream().close();
                    } catch (IOException e) {
                        // just ignore
                    }
                    sps.dispose();
                    //return sps.isAttributeValueSupported(attrval, flavor, attributes);
                    return client.isAttributeValueSupported(attrval,
                            clientFlavors[i], attributes);
                }
            }
View Full Code Here

        OutputStream output;

        if (epsPrinter == null) {
            if (getPrintService() instanceof PSStreamPrintService) {
                StreamPrintService sps = (StreamPrintService)getPrintService();
                mDestType = RasterPrinterJob.STREAM;
                if (sps.isDisposed()) {
                    throw new PrinterException("service is disposed");
                }
                output = sps.getOutputStream();
                if (output == null) {
                    throw new PrinterException("Null output stream");
                }
            } else {
                /* REMIND: This needs to be more maintainable */
 
View Full Code Here

TOP

Related Classes of javax.print.StreamPrintService

Copyright © 2018 www.massapicom. 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.