Package java.awt.print

Examples of java.awt.print.Paper


          break;
        case REVERSE_LANDSCAPE :
          pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
          break;
      }
      Paper paper = new Paper();
      paper.setSize(homePrint.getPaperWidth(), homePrint.getPaperHeight());
      paper.setImageableArea(homePrint.getPaperLeftMargin(), homePrint.getPaperTopMargin(),
          homePrint.getPaperWidth() - homePrint.getPaperLeftMargin() - homePrint.getPaperRightMargin(),
          homePrint.getPaperHeight() - homePrint.getPaperTopMargin() - homePrint.getPaperBottomMargin());
      pageFormat.setPaper(paper);
      pageFormat = printerJob.validatePage(pageFormat);
      return pageFormat;
View Full Code Here


        break;
      default :
        paperOrientation = HomePrint.PaperOrientation.PORTRAIT;
        break;
    }
    Paper paper = this.pageFormat.getPaper();
    HomePrint homePrint = new HomePrint(paperOrientation, (float)paper.getWidth(), (float)paper.getHeight(),
        (float)paper.getImageableY(), (float)paper.getImageableX(),
        (float)(paper.getHeight() - paper.getImageableHeight() - paper.getImageableY()),
        (float)(paper.getWidth() - paper.getImageableWidth() - paper.getImageableX()),
        this.furniturePrintedCheckBox.isSelected(),
        this.planPrintedCheckBox.isSelected(),
        this.view3DPrintedCheckBox.isSelected(),
        this.userPlanScaleRadioButton.isSelected() && this.userPlanScaleSpinner.getValue() != null
            ? 1f / ((Number)this.userPlanScaleSpinner.getValue()).intValue()
View Full Code Here

    public PageFormat getPageFormat(int pageIndex)
    {
        PDPage page = (PDPage)getDocumentCatalog().getAllPages().get( pageIndex );
        PDRectangle mediaBox = page.findMediaBox();
        PageFormat format = new PageFormat();
        Paper paper = new Paper();
        //hmm the imageable area might need to be the CropBox instead
        //of the media box???
        double width=mediaBox.getWidth();
        double height=mediaBox.getHeight();
        if( width > height )
        {
            format.setOrientation( PageFormat.LANDSCAPE );
            width=mediaBox.getHeight();
            height=mediaBox.getWidth();
        }
        paper.setImageableArea( 0,0,width,height);
        paper.setSize( width, height );
        format.setPaper( paper );
        return format;
    }
View Full Code Here

     *
     * @param format The {@link PageFormat} to use.
     * @see #getPageFormat()
     */
    public static void setPageFormat( PageFormat format ) {
        final Paper paper = format.getPaper();
        setPageFormat(
            paper.getWidth(), paper.getHeight(),
            paper.getImageableX(), paper.getImageableY(),
            paper.getImageableWidth(), paper.getImageableHeight(),
            format.getOrientation()
        );
    }
View Full Code Here

        System.out.println("imageable area x: " +
                           pageFormat.getImageableX() + ", y: " + pageFormat.getImageableY() + ", w: " +
                           pageFormat.getImageableWidth() + ", h: " + pageFormat.getImageableHeight());

        Paper paper = pageFormat.getPaper();

        System.out.println("paper area w:" + paper.getWidth() + ", h: " + paper.getHeight());
        System.out.println("imageable area x: " +
                           paper.getImageableX() + ", y: " + paper.getImageableY() + ", w: " +
                           paper.getImageableWidth() + ", h: " + paper.getImageableHeight());
    }
View Full Code Here

    public static synchronized PageFormat getPageFormat( boolean pageDialog ) {
        PageFormatRunner pageFormatRunner = new PageFormatRunner( pageDialog );
        CocoaMainThreadRunner.invokeAndWait( pageFormatRunner );
        final PageFormatInfo info = pageFormatRunner.m_info;

        final Paper paper = new Paper();
        switch ( info.m_orientation ) {

            case PageFormat.PORTRAIT:
                paper.setSize( info.m_paperWidth, info.m_paperHeight );
                paper.setImageableArea(
                    info.m_pageBoundsX, info.m_pageBoundsY,
                    info.m_pageBoundsWidth, info.m_pageBoundsHeight
                );
                break;

            case PageFormat.LANDSCAPE:
                paper.setSize( info.m_paperHeight, info.m_paperWidth );
                paper.setImageableArea(
                    info.m_pageBoundsY, info.m_pageBoundsX,
                    info.m_pageBoundsHeight, info.m_pageBoundsWidth
                );
                break;
        }
View Full Code Here

    }

    private Point2D getPaperCenter() {
        // Don't rely on PageFormat getWidth() and getHeight(), which
        // corrrepsond to imageable area.  Instead, get the real paper center.
        Paper paper = pageFormat.getPaper();
        double width = paper.getWidth();
        double height = paper.getHeight();
        if (pageFormat.getOrientation() != 1) {
            // One of the landscape orientations:
            double temp = width;
            width = height;
            height = temp;
View Full Code Here

    private void savePageFormat(XmlNode pageRoot) {
        int orientation = pageFormat.getOrientation();
        pageRoot.setAttribute(OrientationTag, Integer.toString(orientation));

        Paper paper = pageFormat.getPaper();
        XmlNode paperNode = pageRoot.addChild(PaperTag);

        paperNode.setAttribute(
            "width", Double.toString(paper.getWidth())
        );
        paperNode.setAttribute(
            "height", Double.toString(paper.getHeight())
        );
        paperNode.setAttribute(
            "x", Double.toString(paper.getImageableX())
        );
        paperNode.setAttribute(
            "y", Double.toString(paper.getImageableY())
        );
        paperNode.setAttribute(
            "w", Double.toString(paper.getImageableWidth())
        );
        paperNode.setAttribute(
            "h", Double.toString(paper.getImageableHeight())
        );
    }
View Full Code Here

    private void restorePageFormat(XmlNode pageRoot) throws XMLException {
        int orientation =
            Integer.parseInt(pageRoot.getAttribute(OrientationTag));
        pageFormat.setOrientation(orientation);

        Paper paper = pageFormat.getPaper();
        XmlNode paperNode = pageRoot.getChild(PaperTag);

        // Backwards compatibility: releases 1.0.5 and earlier omitted
        // Paper width and height.
        if (paperNode.hasAttribute("width") && paperNode.hasAttribute("height")) {
            double width = Double.parseDouble(paperNode.getAttribute("width"));
            double height = Double.parseDouble(paperNode.getAttribute("height"));
            paper.setSize(width, height);
        }
        double x = Double.parseDouble(paperNode.getAttribute("x"));
        double y = Double.parseDouble(paperNode.getAttribute("y"));
        double w = Double.parseDouble(paperNode.getAttribute("w"));
        double h = Double.parseDouble(paperNode.getAttribute("h"));
        paper.setImageableArea(x, y, w, h);

        pageFormat.setPaper(paper);
    }
View Full Code Here

            FontRenderContext frc = new FontRenderContext(null, true, true);
            Formatter fmt = new Formatter(report, context, frc, pageStore);
            PageLayout layout = report.getPageLayout();
            Rectangle2D bounds = layout.getBounds(Unit.PT);
            Rectangle2D drawable = layout.getDrawableArea(Unit.PT);
            Paper paper = new Paper();
            paper.setSize(bounds.getWidth(), bounds.getHeight());
            paper.setImageableArea(drawable.getX(), drawable.getY(),
                    drawable.getWidth(), drawable.getHeight());
            PageFormat pf = new PageFormat();
            pf.setOrientation(PageFormat.PORTRAIT);
            pf.setPaper(paper);
            fmt.format(pf);
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.