Package java.awt.print

Examples of java.awt.print.Paper


    }

    // for now, be lazy, assume that the first page is the reference
    final PageDefinition pdef = report.getPageDefinition();
    final PageFormat format = pdef.getPageFormat(0);
    final Paper paper = format.getPaper();

    final Media media = MediaSize.findMedia((float) (paper.getWidth() / POINTS_PER_INCH),
        (float) (paper.getHeight() / POINTS_PER_INCH), Size2DSyntax.INCH);
    attributes.add(media);

    final MediaPrintableArea printableArea = new MediaPrintableArea
        ((float) (paper.getImageableX() / POINTS_PER_INCH),
            (float) (paper.getImageableY() / POINTS_PER_INCH),
            (float) (paper.getImageableWidth() / POINTS_PER_INCH),
            (float) (paper.getImageableHeight() / POINTS_PER_INCH),
            Size2DSyntax.INCH);

    attributes.add(printableArea);
    attributes.add(mapOrientation(format.getOrientation()));
View Full Code Here


  }

  private static Paper createPaper(final MediaSize mediaSize,
                                   final MediaPrintableArea printableArea)
  {
    final Paper paper = new Paper();
    if (mediaSize != null)
    {
      paper.setSize(mediaSize.getX(Size2DSyntax.INCH) * POINTS_PER_INCH,
          mediaSize.getY(Size2DSyntax.INCH) * POINTS_PER_INCH);
    }
    if (printableArea != null)
    {
      paper.setImageableArea
          (printableArea.getX(Size2DSyntax.INCH) * POINTS_PER_INCH,
              printableArea.getY(Size2DSyntax.INCH) * POINTS_PER_INCH,
              printableArea.getWidth(Size2DSyntax.INCH) * POINTS_PER_INCH,
              printableArea.getHeight(Size2DSyntax.INCH) * POINTS_PER_INCH);
    }
View Full Code Here

  }

  public void testCellSize() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(200, 200);
    pff.setBorders(format, 0, 0, 0, 0);

    final SimplePageDefinition p = new SimplePageDefinition(pff.createPageFormat(format, PageFormat.PORTRAIT));

    final MasterReport report = new MasterReport();
View Full Code Here

  }

  public void testCellOnRowSpan() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(200, 200);
    pff.setBorders(format, 0, 0, 0, 0);

    final SimplePageDefinition p = new SimplePageDefinition(pff.createPageFormat(format, PageFormat.PORTRAIT));

    final MasterReport report = new MasterReport();
View Full Code Here

  }

  public void testLandscapeLoadSave() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(PageSize.LETTER);
    pff.setBorders(format, 10, 20, 30, 40);

    final MasterReport orgReport = new MasterReport();
    orgReport.setPageDefinition(new SimplePageDefinition(pff.createPageFormat(format, PageFormat.LANDSCAPE)));
View Full Code Here

  }

  public void testReverseLandscapeLoadSave() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(PageSize.LETTER);
    pff.setBorders(format, 10, 20, 30, 40);

    final MasterReport orgReport = new MasterReport();
    orgReport.setPageDefinition(new SimplePageDefinition(pff.createPageFormat(format, PageFormat.REVERSE_LANDSCAPE)));
View Full Code Here

  }

  public void testPortraitLoadSave() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(PageSize.LETTER);
    pff.setBorders(format, 10, 20, 30, 40);

    final MasterReport orgReport = new MasterReport();
    orgReport.setPageDefinition(new SimplePageDefinition(pff.createPageFormat(format, PageFormat.PORTRAIT)));
View Full Code Here

  private MasterReport createReport(final boolean wrap)
  {
    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();
View Full Code Here

    final double marginBottom = convertLengthToDouble
        (rule.getPropertyCSSValue(BoxStyleKeys.MARGIN_BOTTOM), resolution);

    if (width < height)
    {
      final Paper p = new Paper();
      p.setSize(width, height);
      p.setImageableArea(marginLeft, marginTop,
          width - marginLeft - marginRight,
          height - marginTop - marginBottom);
      final PageFormat pageFormat = new PageFormat();
      pageFormat.setPaper(p);
      pageFormat.setOrientation(PageFormat.PORTRAIT);
      return pageFormat;
    }
    else
    {
      final Paper p = new Paper();
      p.setSize(height, width);
      p.setImageableArea(marginLeft, marginTop,
          width - marginLeft - marginRight,
          height - marginTop - marginBottom);
      final PageFormat pageFormat = new PageFormat();
      pageFormat.setPaper(p);
      pageFormat.setOrientation(PageFormat.LANDSCAPE);
View Full Code Here

    defTopMargin = ParserUtil.parseFloat(atts.getValue(getUri(), PageReadHandler.TOPMARGIN_ATT), defTopMargin);
    defBottomMargin = ParserUtil.parseFloat(atts.getValue(getUri(), PageReadHandler.BOTTOMMARGIN_ATT), defBottomMargin);
    defLeftMargin = ParserUtil.parseFloat(atts.getValue(getUri(), PageReadHandler.LEFTMARGIN_ATT), defLeftMargin);
    defRightMargin = ParserUtil.parseFloat(atts.getValue(getUri(), PageReadHandler.RIGHTMARGIN_ATT), defRightMargin);

    final Paper p = format.getPaper();
    switch (format.getOrientation())
    {
      case PageFormat.PORTRAIT:
        PageFormatFactory.getInstance().setBorders(p, defTopMargin, defLeftMargin,
            defBottomMargin, defRightMargin);
View Full Code Here

TOP

Related Classes of java.awt.print.Paper

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.