Package javax.print

Examples of javax.print.SimpleDoc


        Java14PrintUtil.copyConfiguration(null, report);
    attributes = Java14PrintUtil.copyAuxillaryAttributes(attributes, report);

    final PrintReportProcessor reportPane = new PrintReportProcessor(report);
    final DocPrintJob job = printService.createPrintJob();
    final SimpleDoc document = new SimpleDoc
        (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

    try
    {
      job.print(document, attributes);
View Full Code Here


    try
    {
      reportPane.fireProcessingStarted();

      final DocPrintJob job = service.createPrintJob();
      final SimpleDoc document = new SimpleDoc
          (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

      job.print(document, attributes);
    }
    finally
View Full Code Here

        if (ps == null) {
            throw new NullPrintServiceException(err);
        } else if (rawCmds == null) {
            throw new NullCommandException(err);
        }
        SimpleDoc doc = new SimpleDoc(rawCmds.getBytes(), docFlavor, docAttr);
        DocPrintJob pj = ps.createPrintJob();
        pj.addPrintJobListener(new PrintJobListener() {
            public void printDataTransferCompleted(PrintJobEvent pje) {
                JZebraTools.log(pje);
            }
View Full Code Here

       
        // Dump the printer commands  to console
        System.out.println("JZebra Print Command:\n    > " + commands.replaceAll("\\r", "\n    > "));
       
        // Create our print job, document, document type and print that sucker
        ps.createPrintJob().print(new SimpleDoc(commands.getBytes(), DocFlavor.BYTE_ARRAY.AUTOSENSE, null), null);
        return true;
    }
View Full Code Here

                                                          attributes);

            if (service != null) {
              final PrintRequestAttributeSet final_attributes = attributes;

              final Doc myDoc = new SimpleDoc(messagePrinter, messageFormat, null);

              final DocPrintJob final_job = service.createPrintJob();

              final MessagePrinterDisplay mpd = new MessagePrinterDisplay(messagePrinter, final_job, final_source);
View Full Code Here

                    Debug.logInfo("Adding DocAttribute: " + da, module);
                    docAttributeSet.add((DocAttribute) da);
                }
            }

            Doc myDoc = new SimpleDoc(bais, psInFormat, docAttributeSet);

            PrintService printer = null;

            // lookup the print service for the supplied printer name
            String printerName = (String) serviceContext.remove("printerName");
View Full Code Here

        Java14PrintUtil.copyConfiguration(null, report);
    attributes = Java14PrintUtil.copyAuxillaryAttributes(attributes, report);

    final PrintReportProcessor reportPane = new PrintReportProcessor(report);
    final DocPrintJob job = printService.createPrintJob();
    final SimpleDoc document = new SimpleDoc
        (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

    try
    {
      job.print(document, attributes);
View Full Code Here

    try
    {
      reportPane.fireProcessingStarted();

      final DocPrintJob job = service.createPrintJob();
      final SimpleDoc document = new SimpleDoc
          (reportPane, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);

      job.print(document, attributes);
    }
    finally
View Full Code Here

        StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor, mimeType);
      System.out.println(Arrays.toString(factories));
      if (factories.length > 0) {
        FileOutputStream out = new FileOutputStream(fileName);
        PrintService service = factories[0].getPrintService(out);
        SimpleDoc doc = new SimpleDoc(new Printable() {
          @Override
          public int print(Graphics g, PageFormat pf, int page) {
            if (page >= 1) return Printable.NO_SUCH_PAGE;
            else {
              Graphics2D g2 = (Graphics2D) g;
View Full Code Here

  public void test(TestHarness harness)
  {   
    try
      {
        // printdata matches flavor
        new SimpleDoc(new byte[100], DocFlavor.BYTE_ARRAY.GIF, null);
        harness.check(true);
      }
    catch (RuntimeException e)
      {
        e.printStackTrace();
        harness.check(false);
      }
   
    try
      {
        // check for sublcasses of reader
        new SimpleDoc(new CharArrayReader(new char[]{'A','b'}),
          DocFlavor.READER.TEXT_PLAIN, null);
        harness.check(true);
      }
    catch (RuntimeException e)
      {
        e.printStackTrace();
        harness.check(false);
      }
   
    try
      {
        // printdata does not match flavor
        new SimpleDoc(new byte[100], DocFlavor.CHAR_ARRAY.TEXT_PLAIN, null);
        harness.check(false);
      }
    catch (IllegalArgumentException e)
      {
        harness.check(true);
      }

    try
      {
        new SimpleDoc(null, DocFlavor.CHAR_ARRAY.TEXT_PLAIN, null);
        harness.check(false);
      }
    catch (IllegalArgumentException e)
      {
        harness.check(true);
      }

    try
      {
        new SimpleDoc(new String("kk"), null, null);
        harness.check(false);
      }
    catch (IllegalArgumentException e)
      {
        harness.check(true);
View Full Code Here

TOP

Related Classes of javax.print.SimpleDoc

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.