Package java.awt.print

Examples of java.awt.print.Paper


    return createPageDefinition();
  }

  private void copyPageFormatToFields(final PageFormat pageFormat)
  {
    final Paper paper = pageFormat.getPaper();
    final PageFormatFactory pageFormatFactory = PageFormatFactory.getInstance();
    final String formatName = pageFormatFactory.getPageFormatName(paper.getWidth(), paper.getHeight());
    pageFormatBox.setSelectedItem(formatName);
    pageWidthField.setText(String.valueOf(paper.getWidth()));
    pageHeightField.setText(String.valueOf(paper.getHeight()));
    userDefinedPageSizeBox.setSelected(formatName == null);
    preDefinedPageSizeBox.setSelected(formatName != null);

    final boolean portraitMode = pageFormat.getOrientation() == PageFormat.PORTRAIT;
    portraitModeBox.setSelected(portraitMode);
View Full Code Here


    final float marginTop = ParserUtil.parseFloat(marginTopField.getText(), 0);
    final float marginLeft = ParserUtil.parseFloat(marginLeftField.getText(), 0);
    final float marginBottom = ParserUtil.parseFloat(marginBottomField.getText(), 0);
    final float marginRight = ParserUtil.parseFloat(marginRightField.getText(), 0);

    final Paper p = PageFormatFactory.getInstance().createPaper(pageWidth, pageHeight);
    final PageFormat pf;
    if (portraitModeBox.isSelected())
    {
      PageFormatFactory.getInstance().setBorders(p, marginTop, marginLeft, marginBottom, marginRight);
      pf = PageFormatFactory.getInstance().createPageFormat(p, PageFormat.PORTRAIT);
View Full Code Here

                                  final int row,
                                  final int col,
                                  final PhysicalPageKey pageKey) throws IOException
  {
    final PhysicalPageBox page = pageGrid.getPage(row, col);
    final Paper paper = new Paper();
    paper.setSize(StrictGeomUtility.toExternalValue(page.getWidth()),
        StrictGeomUtility.toExternalValue(page.getHeight()));
    paper.setImageableArea
        (StrictGeomUtility.toExternalValue(page.getImageableX()),
            StrictGeomUtility.toExternalValue(page.getImageableY()),
            StrictGeomUtility.toExternalValue(page.getImageableWidth()),
            StrictGeomUtility.toExternalValue(page.getImageableHeight()));
    drawArea = new StrictBounds(page.getGlobalX(), page.getGlobalY(),
View Full Code Here

    plainTextPage.writePage();
  }

  public void processLogicalPage(final LogicalPageKey key, final LogicalPageBox logicalPage) throws IOException
  {
    final Paper paper = new Paper();
    paper.setSize(StrictGeomUtility.toExternalValue(logicalPage.getPageWidth()),
        StrictGeomUtility.toExternalValue(logicalPage.getPageHeight()));
    paper.setImageableArea(0, 0,
        StrictGeomUtility.toExternalValue(logicalPage.getPageWidth()),
        StrictGeomUtility.toExternalValue(logicalPage.getPageHeight()));
    paper.setSize(logicalPage.getPageWidth(), logicalPage.getPageHeight());
    paper.setImageableArea(0, 0, logicalPage.getPageWidth(), logicalPage.getPageHeight());

    drawArea = new StrictBounds(0, 0, logicalPage.getWidth(), logicalPage.getHeight());
    plainTextPage = new PlainTextPage(paper, driver, encoding);
    startProcessing(logicalPage);
    plainTextPage.writePage();
View Full Code Here

      {
        return new PageFormat();
      }

      final PageFormat pageFormat = pageDefinition.getPageFormat();
      final Paper orgPaper = pageFormat.getPaper();
      final PageFormatFactory pff = PageFormatFactory.getInstance();

      final double virtualPaperWidth = orgPaper.getImageableWidth() +
          pff.getLeftBorder(orgPaper) + pff.getRightBorder(orgPaper);
      final double virtualPaperHeight = orgPaper.getImageableHeight() +
          pff.getTopBorder(orgPaper) + pff.getBottomBorder(orgPaper);

      final Paper p = pff.createPaper(virtualPaperWidth, virtualPaperHeight);
      pff.setBorders(p, pff.getTopBorder(orgPaper), pff.getLeftBorder(orgPaper),
          pff.getBottomBorder(orgPaper), pff.getRightBorder(orgPaper));
      return pff.createPageFormat(p, pageFormat.getOrientation());
    }
View Full Code Here

      defLeftMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.LEFTMARGIN_ATT),
          defLeftMargin);
      defRightMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.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

      throw new ParseException("Orientation value in REPORT-Tag is invalid.",
          getRootHandler().getDocumentLocator());
    }
    if (pageformatName != null)
    {
      final Paper p = PageFormatFactory.getInstance().createPaper(pageformatName);
      if (p == null)
      {
        JFreeReportReadHandler.logger.warn("Unable to create the requested Paper. " + pageformatName);
        return format;
      }
      return PageFormatFactory.getInstance().createPageFormat(p, orientationVal);
    }

    if (atts.getValue(getUri(), JFreeReportReadHandler.WIDTH_ATT) != null &&
        atts.getValue(getUri(), JFreeReportReadHandler.HEIGHT_ATT) != null)
    {
      final int[] pageformatData = new int[2];
      pageformatData[0] = ParserUtil.parseInt(atts.getValue(getUri(), JFreeReportReadHandler.WIDTH_ATT), "No Width set",
          getLocator());
      pageformatData[1] = ParserUtil.parseInt(atts.getValue(getUri(), JFreeReportReadHandler.HEIGHT_ATT),
          "No Height set", getLocator());
      final Paper p = PageFormatFactory.getInstance().createPaper(pageformatData);
      if (p == null)
      {
        JFreeReportReadHandler.logger.warn("Unable to create the requested Paper. Paper={" + pageformatData[0] + ", "
            + pageformatData[1] + '}');
        return format;
View Full Code Here

      final String selectedItem = (String) pageFormatBox.getSelectedItem();
      if (selectedItem == null)
      {
        return;
      }
      final Paper paper = PageFormatFactory.getInstance().createPaper(selectedItem);
      if (paper == null)
      {
        return;
      }
      pageWidthField.setText(String.valueOf(paper.getWidth()));
      pageHeightField.setText(String.valueOf(paper.getHeight()));
    }
View Full Code Here

    if (retval == null)
    {
      throw new NullPointerException();
    }

    final Paper paper = fmt.getPaper();
    final int w = (int) paper.getWidth();
    final int h = (int) paper.getHeight();

    final String pageDefinition = PageFormatFactory.getInstance().getPageFormatName(w, h);
    if (pageDefinition != null)
    {
      retval.setAttribute(ExtParserModule.NAMESPACE,
View Full Code Here

    this.pageDrawable = pageDrawable;

    this.globalX = page.getGlobalX();
    this.globalY = page.getGlobalY();

    final Paper p = new Paper();

    final float marginLeft = (float) StrictGeomUtility.toExternalValue(page.getImageableX());
    final float marginRight = (float) StrictGeomUtility.toExternalValue
        (page.getWidth() - page.getImageableWidth() - page.getImageableX());
    final float marginTop = (float) StrictGeomUtility.toExternalValue(page.getImageableY());
    final float marginBottom = (float) StrictGeomUtility.toExternalValue
        (page.getHeight() - page.getImageableHeight() - page.getImageableY());
    switch (page.getOrientation())
    {
      case PageFormat.PORTRAIT:
        p.setSize(StrictGeomUtility.toExternalValue(page.getWidth()),
            StrictGeomUtility.toExternalValue(page.getHeight()));
        PageFormatFactory.getInstance().setBorders(p, marginTop, marginLeft,
            marginBottom, marginRight);
        break;
      case PageFormat.LANDSCAPE:
        // right, top, left, bottom
        p.setSize(StrictGeomUtility.toExternalValue(page.getHeight()),
            StrictGeomUtility.toExternalValue(page.getWidth()));
        PageFormatFactory.getInstance().setBorders(p, marginRight, marginTop,
            marginLeft, marginBottom);
        break;
      case PageFormat.REVERSE_LANDSCAPE:
        p.setSize(StrictGeomUtility.toExternalValue(page.getHeight()),
            StrictGeomUtility.toExternalValue(page.getWidth()));
        PageFormatFactory.getInstance().setBorders(p, marginLeft, marginBottom,
            marginRight, marginTop);
        break;
      default:
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.