Examples of PageFormat


Examples of java.awt.print.PageFormat

  public static void testPageFormat()
  {
    ClassicEngineBoot.getInstance().start();
    final Paper p = PageFormatFactory.getInstance().createPaper("A4"); //$NON-NLS-1$
    final PageFormat pageFormat = PageFormatFactory.getInstance().createPageFormat(p, PageFormat.LANDSCAPE);
    final double defRightMargin = 70;
    final double defTopMargin = 50;
    final double defLeftMargin = 30;
    final double defBottomMargin= 10;
    PageFormatFactory.getInstance().setBorders(p, defRightMargin, defTopMargin,
            defLeftMargin, defBottomMargin);
    pageFormat.setPaper(p);

    final float marginLeft = (float) pageFormat.getImageableX();
    final float marginRight = (float)
                (pageFormat.getWidth() - pageFormat.getImageableWidth() - pageFormat.getImageableX());
    final float marginTop = (float) (pageFormat.getImageableY());
    final float marginBottom = (float)
                (pageFormat.getHeight() - pageFormat.getImageableHeight() - pageFormat.getImageableY());

    logger.debug ("Margins: Top:    " + marginTop); //$NON-NLS-1$
    logger.debug ("Margins: Left:   " + marginLeft); //$NON-NLS-1$
    logger.debug ("Margins: Bottom: " + marginBottom); //$NON-NLS-1$
    logger.debug ("Margins: Right:  " + marginRight)//$NON-NLS-1$
View Full Code Here

Examples of java.awt.print.PageFormat

        // process image map
        final ImageMap imageMap = RenderUtility.extractImageMap((RenderableReplacedContentBox) node);
        if (imageMap != null)
        {
          final PageDrawable physicalPageDrawable = drawablePanel.getPageDrawable();
          final PageFormat pf = physicalPageDrawable.getPageFormat();
          final float x1 = (float) (event.getSourceEvent().getX() / zoom);
          final float y1 = (float) (event.getSourceEvent().getY() / zoom);
          final float imageMapX = (float) (x1 - pf.getImageableX() - StrictGeomUtility.toExternalValue(node.getX()));
          final float imageMapY = (float) (y1 - pf.getImageableY() - StrictGeomUtility.toExternalValue(node.getY()));
          final ImageMapEntry[] imageMapEntries = imageMap.getEntriesForPoint(imageMapX, imageMapY);
          for (int i = 0; i < imageMapEntries.length; i++)
          {
            final ImageMapEntry entry = imageMapEntries[i];
            final Object imageMapTarget = entry.getAttribute(LibXmlInfo.XHTML_NAMESPACE, "href");
View Full Code Here

Examples of java.awt.print.PageFormat

    if (backend == null)
    {
      return;
    }

    final PageFormat pageFormat = backend.getPageFormat();
    final float outerW = (float) pageFormat.getWidth();
    final float outerH = (float) pageFormat.getHeight();

    final float innerX = (float) pageFormat.getImageableX();
    final float innerY = (float) pageFormat.getImageableY();
    final float innerW = (float) pageFormat.getImageableWidth();
    final float innerH = (float) pageFormat.getImageableHeight();

    final Graphics2D g2 = (Graphics2D) graphics.create();
    //double paperBorder = paperBorderPixel * zoomFactor;

    /** Prepare background **/
    g2.transform(AffineTransform.getScaleInstance(getZoom(), getZoom()));
    g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);

    /** Prepare background **/
    final Rectangle2D pageArea = new Rectangle2D.Float(0, 0, outerW, outerH);
    /**
     * The border around the printable area is painted when the corresponding property is
     * set to true.
     */
    final Rectangle2D printingArea = new Rectangle2D.Float(innerX, innerY, innerW, innerH);

    /** Paint Page Shadow */
    final Rectangle2D southborder = new Rectangle2D.Float
        (getShadowSize(), outerH,
            outerW, getShadowSize());
    final Rectangle2D eastborder = new Rectangle2D.Float
        (outerW, getShadowSize(), getShadowSize(), outerH);

    g2.setPaint(UIManager.getColor("controlShadow")); //$NON-NLS-1$

    g2.fill(southborder);
    g2.fill(eastborder);

    if (isBorderPainted())
    {
      g2.setPaint(Color.gray);
      g2.draw(printingArea);
    }

    g2.setPaint(Color.white);
    g2.fill(pageArea);

    final Graphics2D g22 = (Graphics2D) g2.create();
    backend.draw(g22, new Rectangle2D.Double
        (0, 0, pageFormat.getWidth(), pageFormat.getHeight()));
    g22.dispose();
   
    final Rectangle2D transPageArea = new Rectangle2D.Float(0, 0, outerW, outerH);
    g2.setPaint(Color.black);
    g2.draw(transPageArea);
View Full Code Here

Examples of java.awt.print.PageFormat

    // 0.8.9.4
    Paper paper = pfFact.createPaper(PageSize.A4);
    // // 0.8.8-01 (works also with 0.8.9.4 although deprecated)
    // Paper paper = pfFact.createPaper(PageFormatFactory.A4);
    pfFact.setBordersMm(paper, 25.5, 25.5, 25.5, 25.5);
    PageFormat pf = pfFact.createPageFormat(paper, PageFormat.LANDSCAPE);
    SimplePageDefinition pageDef = new SimplePageDefinition(pf);
    report.setPageDefinition(pageDef);

    ReportHeader header = new ReportHeader();
    header.setName("Report-Header");
View Full Code Here

Examples of java.awt.print.PageFormat

  protected void initializeFromReport()
  {
    final PageDefinition pageDefinition = reportJob.getPageDefinition();
    if (pageDefinition.getPageCount() > 0)
    {
      final PageFormat pageFormat = pageDefinition.getPageFormat(0);
      pageDrawable.setDefaultWidth((int) pageFormat.getWidth());
      pageDrawable.setDefaultHeight((int) pageFormat.getHeight());
    }

    if (reportJob.getTitle() == null)
    {
      setTitle(messages.getString("PreviewPane.EMPTY_TITLE")); //$NON-NLS-1$
View Full Code Here

Examples of java.awt.print.PageFormat

      return;
    }

    final MasterReport report = (MasterReport) o;
    // grab the default page definition ...
    final PageFormat format = report.getPageDefinition().getPageFormat(0);

    final PageFormat definedFormat = configurePageSizeAndMargins(attrs, format);
    final int horizontalSpan = ParserUtil.parseInt(attrs.getValue(getUri(), "horizontal-span"), 1);
    final int verticalSpan = ParserUtil.parseInt(attrs.getValue(getUri(), "vertical-span"), 1);
    pageDefinition = new SimplePageDefinition(definedFormat, horizontalSpan, verticalSpan);
    report.setPageDefinition(pageDefinition);
  }
View Full Code Here

Examples of java.awt.print.PageFormat

    this.drawPageBackground = true;

    final Paper paper = new Paper();
    paper.setImageableArea(0, 0, width, height);

    this.pageFormat = new PageFormat();
    this.pageFormat.setPaper(paper);

    this.strictClipping = "true".equals(metaData.getConfiguration().getConfigProperty
        ("org.pentaho.reporting.engine.classic.core.modules.output.pageable.graphics.StrictClipping"));
    this.outlineMode = "true".equals(metaData.getConfiguration().getConfigProperty
View Full Code Here

Examples of java.awt.print.PageFormat

  {
    final MasterReport report = (MasterReport)
        getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);

    // grab the default page definition ...
    PageFormat format = report.getPageDefinition().getPageFormat(0);
    float defTopMargin = (float) format.getImageableY();
    float defBottomMargin = (float) (format.getHeight() - format.getImageableHeight()
        - format.getImageableY());
    float defLeftMargin = (float) format.getImageableX();
    float defRightMargin = (float) (format.getWidth() - format.getImageableWidth()
        - format.getImageableX());

    format = createPageFormat(format, atts);

    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);
        break;
      case PageFormat.LANDSCAPE:
        // right, top, left, bottom
        PageFormatFactory.getInstance().setBorders(p, defRightMargin, defTopMargin,
            defLeftMargin, defBottomMargin);
        break;
      case PageFormat.REVERSE_LANDSCAPE:
        PageFormatFactory.getInstance().setBorders(p, defLeftMargin, defBottomMargin,
            defRightMargin, defTopMargin);
        break;
      default:
        // will not happen..
        throw new IllegalArgumentException("Unexpected paper orientation.");
    }

    format.setPaper(p);
    pageFormat = format;
  }
View Full Code Here

Examples of java.awt.print.PageFormat

    {
      final SimplePageDefinition simplePageDefinition = (SimplePageDefinition) original;
      spanHorizontalField.setText(String.valueOf(simplePageDefinition.getPageCountHorizontal()));
      spanVerticalField.setText(String.valueOf(simplePageDefinition.getPageCountVertical()));

      final PageFormat pageFormat = simplePageDefinition.getPageFormat();
      copyPageFormatToFields(pageFormat);
    }
    else if (original != null)
    {
      spanHorizontalField.setText(null);
      spanVerticalField.setText(null);

      if (original.getPageCount() > 0)
      {
        final PageFormat pageFormat = original.getPageFormat(0);
        copyPageFormatToFields(pageFormat);
      }
      else
      {
        preDefinedPageSizeBox.setSelected(true);
View Full Code Here

Examples of java.awt.print.PageFormat

    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
TOP
Copyright © 2018 www.massapi.com. 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.