Package java.awt.print

Examples of java.awt.print.PageFormat


  public void testSerializeFilled ()
          throws IOException, ClassNotFoundException
  {
    final CustomPageDefinition cpd = new CustomPageDefinition();
    cpd.addPageFormat(new PageFormat(), 0, 0);
    cpd.addPageFormat(new PageFormat(), 0, 400);
    cpd.addPageFormat(new PageFormat(), 400, 0);
    cpd.addPageFormat(new PageFormat(), 400, 400);

    final ByteArrayOutputStream bo = new ByteArrayOutputStream();
    final ObjectOutputStream out = new ObjectOutputStream(bo);
    out.writeObject(cpd);
    out.close();
View Full Code Here


   * @param pos the position of the pageformat within the page
   * @return the given pageformat.
   */
  public PageFormat getPageFormat(final int pos)
  {
    final PageFormat fmt = (PageFormat) pageFormatList.get(pos);
    return (PageFormat) fmt.clone();
  }
View Full Code Here

    }

    o = instance.readObject(in);
    while (o != null)
    {
      final PageFormat format = (PageFormat) o;
      pageFormatList.add(format);
      o = instance.readObject(in);
    }
  }
View Full Code Here

      return false;
    }

    for (int i = 0; i < pageFormatList.size(); i++)
    {
      final PageFormat pf = (PageFormat) pageFormatList.get(i);
      final PageFormat cpf = (PageFormat) customPageDefinition.pageFormatList.get(i);
      if (PageFormatFactory.isEqual(pf, cpf) == false)
      {
        return false;
      }
    }
View Full Code Here

   *
   * <p>For child instances, the stream is already open, so this should keep
   * things happy.
   */
  private void init() {
      PageFormat pf = page.getPageFormat();

      // save graphics state (restored by dispose)
    if(child) {
      pw.print("q ");
    }

    // now initialise the instance
    //setColor(Color.black);
    paint = Color.black;
    // possible: if parent.color is not black, then force black?
    // must check to see what AWT does?
   
    // Original User Space Transform (identity)
    oTransform = new AffineTransform();
   
    // Transform from Java Space to PDF Space
  pTransform = new AffineTransform();
  pTransform.translate(0, pf.getHeight());
  pTransform.scale(1d, -1d);

  // Combined Transform User->Java->PDF
  transform = new AffineTransform(oTransform);
  transform.concatenate(pTransform);
View Full Code Here

   * Initializes a new instance of <code>PDFPrinterJob</code>.
   */
  public PDFPrinterJob() {
    attributes = new HashPrintRequestAttributeSet();
    info = new PDFInfo();
    pageFormat = new PageFormat(); // default page format.
    setJobName("Java Printing");
  }
View Full Code Here

  {
    if (paper == null)
    {
      throw new NullPointerException("Paper given must not be null");
    }
    final PageFormat pf = new PageFormat();
    pf.setPaper(paper);
    pf.setOrientation(orientation);
    return pf;
  }
View Full Code Here

        final MasterReport masterReport = (MasterReport) parent;
        return masterReport.getPageDefinition();
      }
      parent = parent.getParentSection();
    }
    return new SimplePageDefinition(new PageFormat());
  }
View Full Code Here

                return;
            }

            //  Get properties from PrintDialog UI
            PrinterJob printerJob = printerDialog.getPrinterJob();
            PageFormat pageFormat = printerJob.defaultPage();
            printerJob.setJobNamed.toString() );

            d.setSelectionPrintMode( ((Boolean)printerDialog.getPropertyValue(PrintDialog.PRINT_SELECTION)).booleanValue() );
            d.setPrintBackgroundColor( ((Boolean)printerDialog.getPropertyValue(PrintDialog.PRINT_BACKGROUND)).booleanValue());
            d.setScaleSheet(((Boolean)printerDialog.getPropertyValue(PrintDialog.SCALE_SHEET)).booleanValue());
            pageFormat.setOrientation( ((Integer)printerDialog.getPropertyValue(PrintDialog.ORIENTATION)).intValue() );
            pageFormat.setPaperPrintDialog.getPaper( ((Integer)printerDialog.getPropertyValue(PrintDialog.PAPER_SIZE)).intValue() ));
            printerJob.setCopies(((Integer)printerDialog.getPropertyValue(PrintDialog.NB_COPIES)).intValue() );

            printerJob.setPageable(new PagesToPrint(d, pageFormat));

            setStatus(messageWriter.print1args("printingTo", printerJob.getPrintService().getName()));
View Full Code Here

  /**
   * Default prining context is A4 landscape
   */
  public PrintFormat() {
    pageFormat = new PageFormat();
   
    // Sets the defaults
    setPaper("A4");
    pageFormat.setOrientation(PageFormat.LANDSCAPE);
  }
View Full Code Here

TOP

Related Classes of java.awt.print.PageFormat

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.