Package java.awt.print

Examples of java.awt.print.Paper


                                  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

        if (!mediaBox.equals(cropBox))
        {
            diffWidth = (mediaWidth - cropWidth)/2;
            diffHeight = (mediaHeight - cropHeight)/2;
        }
        Paper paper = new Paper();
        paper.setImageableArea( diffWidth, diffHeight, cropWidth, cropHeight);
        paper.setSize( mediaWidth, mediaHeight );
        PageFormat format = new PageFormat();
        format.setPaper( paper );
        return format;
    }
View Full Code Here

            printerJob.defaultPage();

        //
        // Set the page parameters from the hints
        //
        Paper paper = pageFormat.getPaper();

        Float pageWidth = (Float)hints.get(KEY_PAGE_WIDTH);
        Float pageHeight = (Float)hints.get(KEY_PAGE_HEIGHT);
        if(pageWidth != null){
            paper.setSize(pageWidth.floatValue(),
                          paper.getHeight());
        }
        if(pageHeight != null){
            paper.setSize(paper.getWidth(),
                          pageHeight.floatValue());
        }

        float x=0, y=0;
        float width=(float)paper.getWidth(), height=(float)paper.getHeight();

        Float leftMargin = (Float)hints.get(KEY_MARGIN_LEFT);
        Float topMargin = (Float)hints.get(KEY_MARGIN_TOP);
        Float rightMargin = (Float)hints.get(KEY_MARGIN_RIGHT);
        Float bottomMargin = (Float)hints.get(KEY_MARGIN_BOTTOM);

        if(leftMargin != null){
            x = leftMargin.floatValue();
            width -= leftMargin.floatValue();
        }
        if(topMargin != null){
            y = topMargin.floatValue();
            height -= topMargin.floatValue();
        }
        if(rightMargin != null){
            width -= rightMargin.floatValue();
        }
        if(bottomMargin != null){
            height -= bottomMargin.floatValue();
        }

        paper.setImageableArea(x, y, width, height);

        String pageOrientation = (String)hints.get(KEY_PAGE_ORIENTATION);
        if(VALUE_PAGE_ORIENTATION_PORTRAIT.equalsIgnoreCase(pageOrientation)){
            pageFormat.setOrientation(pageFormat.PORTRAIT);
        }
View Full Code Here

        final PageFormat pageFormat = printerJob.defaultPage();
       
       
        //setup the paper
       
        Paper paper = new Paper();
        Rectangle pageSize = getITextPageSize(page1.getPageSize());
        paper.setSize(pageSize.getWidth(), pageSize.getHeight());
        //paper.setSize(11.7*72, 16.5*72);
        //double imageableWidth = paper.getWidth() - MARGIN*2;
        //double imageableHeight = paper.getHeight() - MARGIN*2;
        paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight() );
        pageFormat.setPaper(paper);

       
        if (page1.getTemplateFactory().createTemplate().getPreferredOrientation() == Template.ORIENTATION_LANDSCAPE) {
            pageFormat.setOrientation(PageFormat.LANDSCAPE);
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

    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 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

    final double topBorder = Double.parseDouble(attrs.getValue(getUri(), "topBorder"));
    final double leftBorder = Double.parseDouble(attrs.getValue(getUri(), "leftBorder"));
    final double bottomBorder = Double.parseDouble(attrs.getValue(getUri(), "bottomBorder"));
    final double rightBorder = Double.parseDouble(attrs.getValue(getUri(), "rightBorder"));

    final Paper paper = PageFormatFactory.getInstance().createPaper(pageSize.getWidth(), pageSize.getHeight());
    PageFormatFactory.getInstance().setBorders(paper, topBorder, leftBorder, bottomBorder, rightBorder);

    pageFormat = new PageFormat();
    pageFormat.setPaper(paper);
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.