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

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

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

Rectangle.<init>介绍

[英]Constructs a Rectangle -object starting from the origin (0, 0).
[中]从原点(0,0)开始构造Rectangle对象。

代码示例

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

/**
 * Rotates the rectangle. Swaps the values of llx and lly and of urx and ury.
 * 
 * @return the rotated <CODE>Rectangle</CODE>
 */
public Rectangle rotate() {
 Rectangle rect = new Rectangle(lly, llx, ury, urx);
 rect.rotation = rotation + 90;
 rect.rotation %= 360;
 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() {
  float width = ((code.length() + 1) * 5 + 1) * n + x;
  return new Rectangle(width, barHeight);
}

代码示例来源: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() {
  float width = ((code.length() + 1) * 5 + 1) * n + x;
  return new Rectangle(width, barHeight);
}

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

/** Sets the field dimension and position.
 * @param box the field dimension and position
 */
public void setBox(Rectangle box) {
  if (box == null) {
    this.box = null;
  }
  else {
    this.box = new Rectangle(box);
    this.box.normalize();
  }
}

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

/** Creates a new event. This constructor will be used if you need to position fields with a Cell Event. 
 * @throws DocumentException
 * @throws IOException*/
public FieldPositioningEvents(PdfWriter writer, PdfFormField parent, String text) throws IOException, DocumentException {
  this.parent = parent;
  TextField tf = new TextField(writer, new Rectangle(0, 0), text);
  tf.setFontSize(14);
  cellField = tf.getTextField();
}

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

/** Creates a new event. This constructor will be used if you need to position fields with a Cell Event. 
 * @throws DocumentException
 * @throws IOException*/
public FieldPositioningEvents(PdfWriter writer, PdfFormField parent, String text) throws IOException, DocumentException {
  this.parent = parent;
  TextField tf = new TextField(writer, new Rectangle(0, 0), text);
  tf.setFontSize(14);
  cellField = tf.getTextField();
}

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

/** Creates a new event. This constructor will be used if you need to position fields with a Cell Event. 
 * @throws DocumentException
 * @throws IOException*/
public FieldPositioningEvents(PdfWriter writer, String text) throws IOException, DocumentException {
  this.fieldWriter = writer;
  TextField tf = new TextField(writer, new Rectangle(0, 0), text);
  tf.setFontSize(14);
  cellField = tf.getTextField();
}

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

/** Creates a new event. This constructor will be used if you need to position fields with a Cell Event. 
 * @throws DocumentException
 * @throws IOException*/
public FieldPositioningEvents(PdfWriter writer, PdfFormField parent, String text) throws IOException, DocumentException {
  this.parent = parent;
  TextField tf = new TextField(writer, new Rectangle(0, 0), text);
  tf.setFontSize(14);
  cellField = tf.getTextField();
}

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

public PdfAnnotation createAnnotation(PdfWriter writer) {
  PdfAnnotation annotation = new PdfAnnotation(writer, new Rectangle(llx, lly, urx, ury));
  if (newPage != 0) {
    PdfIndirectReference ref = writer.getPageReference(newPage);
    destination.set(0, ref);
  }
  if (destination != null) annotation.put(PdfName.DEST, destination);
  annotation.hashMap.putAll(parameters);
  return annotation;
}

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

public PdfAnnotation createAnnotation(PdfWriter writer) {
 PdfAnnotation annotation = new PdfAnnotation(writer, new Rectangle(llx, lly, urx, ury));
 if (newPage != 0) {
  PdfIndirectReference ref = writer.getPageReference(newPage);
  destination.set(0, ref);
 }
 if (destination != null) {
  annotation.put(PdfName.DEST, destination);
 }
 annotation.hashMap.putAll(parameters);
 return annotation;
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

private com.lowagie.text.Rectangle add(com.lowagie.text.Rectangle r1, com.lowagie.text.Rectangle r2) {
  float llx = Math.min(r1.getLeft(), r2.getLeft());
  float urx = Math.max(r1.getRight(), r2.getRight());
  float lly = Math.min(r1.getBottom(), r2.getBottom());
  float ury = Math.max(r1.getTop(), r2.getTop());
  
  return new com.lowagie.text.Rectangle(llx, lly, urx, ury);
}

代码示例来源:origin: org.xhtmlrenderer/flying-saucer-pdf-openpdf

private com.lowagie.text.Rectangle add(com.lowagie.text.Rectangle r1, com.lowagie.text.Rectangle r2) {
  float llx = Math.min(r1.getLeft(), r2.getLeft());
  float urx = Math.max(r1.getRight(), r2.getRight());
  float lly = Math.min(r1.getBottom(), r2.getBottom());
  float ury = Math.max(r1.getTop(), r2.getTop());
  return new com.lowagie.text.Rectangle(llx, lly, urx, ury);
}

代码示例来源:origin: org.docx4j/xhtmlrenderer

private com.lowagie.text.Rectangle add(com.lowagie.text.Rectangle r1, com.lowagie.text.Rectangle r2) {
  float llx = Math.min(r1.getLeft(), r2.getLeft());
  float urx = Math.max(r1.getRight(), r2.getRight());
  float lly = Math.min(r1.getBottom(), r2.getBottom());
  float ury = Math.max(r1.getTop(), r2.getTop());
  return new com.lowagie.text.Rectangle(llx, lly, urx, ury);
}

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

/**
 * Returns the high level version of this PdfRectangle
 * @return this PdfRectangle translated to class Rectangle
 */
public Rectangle getRectangle() {
  return new Rectangle(left(), bottom(), right(), top());
}

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

/**
 * Return a rectangle with the size of this component and origin (0,0).
 * 
 * @return rectangle with the size of this component
 */
protected Rectangle getSize() {
  return new Rectangle(getBounds().getWidth(), getBounds().getHeight());
}

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

/**
 * Converts an absolute rectangle to a relative one wrt to the current coordinate system.
 *
 * @param rect absolute rectangle
 * @return relative rectangle
 */
public Rectangle toRelative(Rectangle rect) {
  return new Rectangle(rect.getLeft() - origX, rect.getBottom() - origY, rect.getRight() - origX, rect.getTop()
      - origY);
}

代码示例来源: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: org.xhtmlrenderer/flying-saucer-pdf

public void writeNextDocument(int initialPageNo) throws DocumentException {
  List pages = _root.getLayer().getPages();
  RenderingContext c = newRenderingContext();
  c.setInitialPageNo(initialPageNo);
  PageBox firstPage = (PageBox) pages.get(0);
  com.lowagie.text.Rectangle firstPageSize = new com.lowagie.text.Rectangle(0, 0, firstPage.getWidth(c) / _dotsPerPoint,
      firstPage.getHeight(c) / _dotsPerPoint);
  _outputDevice.setStartPageNo(_writer.getPageNumber());
  _pdfDoc.setPageSize(firstPageSize);
  _pdfDoc.newPage();
  writePDF(pages, c, firstPageSize, _pdfDoc, _writer);
}

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

@Override
public void calculateSize(PdfContext context) {
  Rectangle textSize = context.getTextSize(label, getLegend().getFont());
  float margin = 0.25f * getLegend().getFont().getSize();
  getConstraint().setMarginX(margin);
  getConstraint().setMarginY(margin);
  setBounds(new Rectangle(textSize.getHeight(), textSize.getHeight()));
}

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

@Override
public void calculateSize(PdfContext context) {
  Rectangle textSize = context.getTextSize(label, getLegend().getFont());
  float margin = 0.25f * getLegend().getFont().getSize();
  getConstraint().setMarginX(margin);
  getConstraint().setMarginY(margin);
  setBounds(new Rectangle(textSize.getHeight(), textSize.getHeight()));
}

相关文章

微信公众号

最新文章

更多