com.lowagie.text.Rectangle.getWidth()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中com.lowagie.text.Rectangle.getWidth方法的一些代码示例,展示了Rectangle.getWidth的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.getWidth方法的具体详情如下:
包路径:com.lowagie.text.Rectangle
类名称:Rectangle
方法名:getWidth

Rectangle.getWidth介绍

[英]Returns the width of the rectangle.
[中]返回矩形的宽度。

代码示例

代码示例来源:origin: javamelody/javamelody

/** {@inheritDoc} */
@Override
public void onEndPage(PdfWriter writer, Document document) {
  final int pageN = writer.getPageNumber();
  final String text = pageN + " / ";
  final float len = bf.getWidthPoint(text, 8);
  cb.beginText();
  cb.setFontAndSize(bf, 8);
  final float width = document.getPageSize().getWidth();
  cb.setTextMatrix(width / 2, 30);
  cb.showText(text);
  cb.endText();
  cb.addTemplate(template, width / 2 + len, 30);
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

/**
 * Gets the bounding width of this template.
 *
 * @return width the bounding width
 */
public float getWidth() {
  return bBox.getWidth();
}

代码示例来源:origin: com.github.librepdf/openpdf

/**
 * Gets the bounding width of this template.
 *
 * @return width the bounding width
 */
public float getWidth() {
  return bBox.getWidth();
}

代码示例来源:origin: com.github.librepdf/openpdf

/**
 * Gets the visibility status of the signature.
 * 
 * @return the visibility status of the signature
 */
public boolean isInvisible() {
 return (rect == null || rect.getWidth() == 0 || rect.getHeight() == 0);
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

private void drawLine(PdfContext context, Rectangle iconRect, Color strokeColor, float[] dashArray) {
  float baseWidth = iconRect.getWidth() / 10;
  context.drawRelativePath(new float[] {0f, 0.75f, 0.25f, 1f},
      new float[]{0f, 0.25f, 0.75f, 1f}, iconRect, strokeColor, baseWidth * 2, dashArray);
}

代码示例来源:origin: com.github.bengolder/pdf-rtf

/**
   * This method compares to Rectangles. They are considered equal if width and height are the same
   * 
   * @param rect1 The first Rectangle to compare
   * @param rect2 The second Rectangle to compare
   * @return <code>True</code> if the Rectangles equal, <code>false</code> otherwise
   */
  private boolean rectEquals(Rectangle rect1, Rectangle rect2) {
    return (rect1.getWidth() == rect2.getWidth()) && (rect1.getHeight() == rect2.getHeight());
  }
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

/**
 * Gets the visibility status of the signature.
 * @return the visibility status of the signature
 */
public boolean isInvisible() {
  return (this.rect == null || this.rect.getWidth() == 0 || this.rect.getHeight() == 0);
}

代码示例来源:origin: fr.opensagres.xdocreport.itext-gae/itext-gae

/**
 * Gets the visibility status of the signature.
 * @return the visibility status of the signature
 */    
public boolean isInvisible() {
  return (rect == null || rect.getWidth() == 0 || rect.getHeight() == 0);
}

代码示例来源:origin: com.github.librepdf/openpdf

/** Gets the maximum area that the barcode and the text, if
 * any, will occupy. The lower left corner is always (0, 0).
 * @return the size the barcode occupies.
 */
public Rectangle getBarcodeSize() {
  Rectangle rect = ean.getBarcodeSize();
  rect.setRight(rect.getWidth() + supp.getBarcodeSize().getWidth() + n);
  return rect;
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

/** Gets the maximum area that the barcode and the text, if
 * any, will occupy. The lower left corner is always (0, 0).
 * @return the size the barcode occupies.
 */
public Rectangle getBarcodeSize() {
  Rectangle rect = ean.getBarcodeSize();
  rect.setRight(rect.getWidth() + supp.getBarcodeSize().getWidth() + n);
  return rect;
}

代码示例来源:origin: com.github.librepdf/openpdf

private void drawBottomFrame(PdfAppearance app) {
  app.moveTo(borderWidth, borderWidth);
  app.lineTo(box.getWidth() - borderWidth, borderWidth);
  app.lineTo(box.getWidth() - borderWidth, box.getHeight() - borderWidth);
  app.lineTo(box.getWidth() - 2 * borderWidth, box.getHeight() - 2 * borderWidth);
  app.lineTo(box.getWidth() - 2 * borderWidth, 2 * borderWidth);
  app.lineTo(2 * borderWidth, 2 * borderWidth);
  app.lineTo(borderWidth, borderWidth);
  app.fill();
}
/** Gets the border width in points.

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

private void drawBottomFrame(PdfAppearance app) {
  app.moveTo(borderWidth, borderWidth);
  app.lineTo(box.getWidth() - borderWidth, borderWidth);
  app.lineTo(box.getWidth() - borderWidth, box.getHeight() - borderWidth);
  app.lineTo(box.getWidth() - 2 * borderWidth, box.getHeight() - 2 * borderWidth);
  app.lineTo(box.getWidth() - 2 * borderWidth, 2 * borderWidth);
  app.lineTo(2 * borderWidth, 2 * borderWidth);
  app.lineTo(borderWidth, borderWidth);
  app.fill();
}
/** Gets the border width in points.

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

/**
 * Initializes context size.
 *
 * @param rectangle rectangle
 */
public void initSize(Rectangle rectangle) {
  template = writer.getDirectContent().createTemplate(rectangle.getWidth(), rectangle.getHeight());
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

@Override
public void calculateSize(PdfContext context) {
  Rectangle textSize = context.getTextSize(getText(), getFont());
  margin = 0.25f * getFont().getSize();
  setBounds(new Rectangle(textSize.getWidth() + 2 * margin, textSize.getHeight() + 2 * margin));
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

private void drawTopFrame(PdfAppearance app) {
  app.moveTo(borderWidth, borderWidth);
  app.lineTo(borderWidth, box.getHeight() - borderWidth);
  app.lineTo(box.getWidth() - borderWidth, box.getHeight() - borderWidth);
  app.lineTo(box.getWidth() - 2 * borderWidth, box.getHeight() - 2 * borderWidth);
  app.lineTo(2 * borderWidth, box.getHeight() - 2 * borderWidth);
  app.lineTo(2 * borderWidth, 2 * borderWidth);
  app.lineTo(borderWidth, borderWidth);
  app.fill();
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

private float getPageSizeRelativeToA3(PrintGetTemplateRequest request) {
  Rectangle r;
  if (request.getPageSize() != null) {
    r = PageSize.getRectangle(request.getPageSize());
  } else {
    float width = request.getTemplate().getPage().getLayoutConstraint().getWidth();
    float height = request.getTemplate().getPage().getLayoutConstraint().getHeight();
    r = new Rectangle(0, 0, width, height);
  }
  return (r.getWidth() / PageSize.A3.getWidth() + r.getHeight() / PageSize.A3.getHeight()) / 2;
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

public void fillRoundRectangle(Rectangle rect, Color color, float r) {
  template.saveState();
  setFill(color);
  template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r);
  template.fill();
  template.restoreState();
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

public void setSize(String size, boolean landscape) {
  Rectangle rect = null;
  if (landscape) {
    rect = PageSize.getRectangle(size).rotate();
  } else {
    rect = PageSize.getRectangle(size);
  }
  setBounds(rect);
  getConstraint().setWidth(rect.getWidth());
  getConstraint().setHeight(rect.getHeight());
}

代码示例来源:origin: SonarQubeCommunity/sonar-pdf-report

private void formatTable(final PdfPTable table) {
 Rectangle page = document.getPageSize();
 table.getDefaultCell().setVerticalAlignment(PdfCell.ALIGN_MIDDLE);
 table.getDefaultCell().setPaddingBottom(tablePaddingBottom);
 table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER);
 table.setTotalWidth(page.getWidth() - document.leftMargin()
   - document.rightMargin());
 table.setSpacingBefore(20);
}

代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-printing

Envelope createBbox() {
  double x1 = getMap().getLocation().x;
  double x2 = x1 + (getBounds().getWidth() / getMap().getPpUnit());
  double y1 = getMap().getLocation().y;
  double y2 = y1 + (getBounds().getHeight() / getMap().getPpUnit());
  return new Envelope(x1, x2, y1, y2);
}

相关文章

微信公众号

最新文章

更多