Package java.awt.print

Examples of java.awt.print.PageFormat


  }

  public void testFailure() throws Exception
  {
    final MasterReport basereport = new MasterReport();
    basereport.setPageDefinition(new SimplePageDefinition(new PageFormat()));
    final MasterReport report = createReport();
    final LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand
        (basereport, report.getReportHeader());
    // simple test, we assert that all paragraph-poolboxes are on either 485000 or 400000
    // and that only two lines exist for each
View Full Code Here


  {
    final MasterReport report = new MasterReport();
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper paper = pff.createPaper(PageSize.A4);
    pff.setBorders(paper, 36.0f, 36.0f, 36.0f, 36.0f);
    final PageFormat format = pff.createPageFormat(paper, PageFormat.PORTRAIT);
    report.setPageDefinition(new SimplePageDefinition(format));

    final Band pageHeader = report.getPageHeader();
    pageHeader.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 10.0f);
View Full Code Here

  {
    final MasterReport report = new MasterReport();
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper paper = pff.createPaper(PageSize.A4);
    pff.setBorders(paper, 36.0f, 36.0f, 36.0f, 36.0f);
    final PageFormat format = pff.createPageFormat(paper, PageFormat.PORTRAIT);
    report.setPageDefinition(new SimplePageDefinition(format));

    final Band pageHeader = report.getPageHeader();
    pageHeader.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 10.0f);
View Full Code Here

      // use A4...
      final PageFormatFactory pff = PageFormatFactory.getInstance();
      final Paper paper = pff.createPaper(PageSize.A4);
      pff.setBorders(paper, PAGE_MARGIN_TOP, PAGE_MARGIN_LEFT, PAGE_MARGIN_BOTTOM, PAGE_MARGIN_RIGHT);
      final PageFormat format = pff.createPageFormat(paper, PageFormat.PORTRAIT);
      report.setPageDefinition(new SimplePageDefinition(format));

      setupWatermark(report);
      setupPageHeader(report);
      //// REPORT GROUP /////////////////////////////////////////////////////////////////////////
View Full Code Here

  }

  public void testNestedRows() throws Exception
  {
    final MasterReport basereport = new MasterReport();
    basereport.setPageDefinition(new SimplePageDefinition(new PageFormat()));
    final URL target = LayoutTest.class.getResource("nested-rows.xml");
    final ResourceManager rm = new ResourceManager();
    rm.registerDefaults();
    final Resource directly = rm.createDirectly(target, MasterReport.class);
    final MasterReport report = (MasterReport) directly.getResource();
View Full Code Here

   * @return the generated image.
   */
  private BufferedImage createImage(final PageDefinition pd)
  {
    // in this simple case we know, that all pages have the same size..
    final PageFormat pf = pd.getPageFormat(0);

    final double width = pf.getWidth();
    final double height = pf.getHeight();
    //write the report to the temp file
    return new BufferedImage
        ((int) width, (int) height, BufferedImage.TYPE_BYTE_INDEXED);
  }
View Full Code Here

    // use A4...
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper paper = pff.createPaper(PageSize.A4);
    pff.setBorders(paper, PAGE_MARGIN_TOP, PAGE_MARGIN_LEFT, PAGE_MARGIN_BOTTOM, PAGE_MARGIN_RIGHT);
    final PageFormat format = pff.createPageFormat(paper, PageFormat.PORTRAIT);
    report.setPageDefinition(new SimplePageDefinition(format));

    setupWatermark(report);
    setupPageHeader(report);
    //// REPORT GROUP /////////////////////////////////////////////////////////////////////////
View Full Code Here

   * @throws IOException if an I/O error occured.
   */
  public void writeObject (final Object o, final ObjectOutputStream out)
          throws IOException
  {
    final PageFormat pf = (PageFormat) o;
    out.writeObject(resolvePageFormat(pf));
  }
View Full Code Here

    final float[] dim = (float[]) data[1];
    final float[] rect = (float[]) data[2];
    final Paper p = new Paper();
    p.setSize(dim[0], dim[1]);
    p.setImageableArea(rect[0], rect[1], rect[2], rect[3]);
    final PageFormat format = new PageFormat();
    format.setPaper(p);
    format.setOrientation(orientation.intValue());
    return format;
  }
View Full Code Here

    if (mediaSize == null)
    {
      logger.warn("Unknown media encountered, unable to compute page sizes.");
    }

    final PageFormat pageFormat = new PageFormat();
    pageFormat.setPaper(createPaper(mediaSize, printableArea));
    if (OrientationRequested.PORTRAIT.equals(orientationRequested))
    {
      pageFormat.setOrientation(PageFormat.PORTRAIT);
    }
    else if (OrientationRequested.LANDSCAPE.equals(orientationRequested))
    {
      pageFormat.setOrientation(PageFormat.LANDSCAPE);
    }
    else if (OrientationRequested.REVERSE_LANDSCAPE.equals
        (orientationRequested))
    {
      pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
    }
    else if (OrientationRequested.REVERSE_PORTRAIT.equals(orientationRequested))
    {
      pageFormat.setOrientation(PageFormat.PORTRAIT);
    }
    return pageFormat;
  }
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.