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

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

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

Rectangle.setBottom介绍

[英]Sets the lower left y-coordinate.
[中]设置左下角的y坐标。

代码示例

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

/**
 * Sets the bounding height of this template.
 *
 * @param height the bounding height
 */

public void setHeight(float height) {
  bBox.setBottom(0);
  bBox.setTop(height);
}

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

/**
 * Sets the bounding height of this template.
 *
 * @param height the bounding height
 */

public void setHeight(float height) {
  bBox.setBottom(0);
  bBox.setTop(height);
}

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

/**
 * Sets the bounding height of this template.
 *
 * @param height the bounding height
 */

public void setHeight(float height) {
  bBox.setBottom(0);
  bBox.setTop(height);
}

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

/**
 * Gets a Rectangle that is altered to fit on the page.
 * 
 * @param top        the top position
 * @param bottom    the bottom position
 * @return a <CODE>Rectangle</CODE>
 */
public Rectangle rectangle(float top, float bottom) {
  Rectangle tmp = new Rectangle(this);
  if (getTop() > top) {
    tmp.setTop(top);
    tmp.disableBorderSide(TOP);
  }
  if (getBottom() < bottom) {
    tmp.setBottom(bottom);
    tmp.disableBorderSide(BOTTOM);
  }
  return tmp;
}

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

/**
 * Gets a Rectangle that is altered to fit on the page.
 * 
 * @param top        the top position
 * @param bottom    the bottom position
 * @return a <CODE>Rectangle</CODE>
 */
public Rectangle rectangle(float top, float bottom) {
  Rectangle tmp = new Rectangle(this);
  if (getTop() > top) {
    tmp.setTop(top);
    tmp.disableBorderSide(TOP);
  }
  if (getBottom() < bottom) {
    tmp.setBottom(bottom);
    tmp.disableBorderSide(BOTTOM);
  }
  return tmp;
}

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

/**
 * Move this rectangle to the specified bottom-left point.
 *
 * @param rect rectangle to move
 * @param x new x origin
 * @param y new y origin
 */
public void moveRectangleTo(Rectangle rect, float x, float y) {
  float width = rect.getWidth();
  float height = rect.getHeight();
  rect.setLeft(x);
  rect.setBottom(y);
  rect.setRight(rect.getLeft() + width);
  rect.setTop(rect.getBottom() + height);
}

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

/**
 * Gets a Rectangle that is altered to fit on the page.
 * 
 * @param top
 *          the top position
 * @param bottom
 *          the bottom position
 * @return a <CODE>Rectangle</CODE>
 */
public Rectangle rectangle(float top, float bottom) {
 Rectangle tmp = new Rectangle(this);
 if (getTop() > top) {
  tmp.setTop(top);
  tmp.disableBorderSide(TOP);
 }
 if (getBottom() < bottom) {
  tmp.setBottom(bottom);
  tmp.disableBorderSide(BOTTOM);
 }
 return tmp;
}

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

/**
 * Translate this rectangle over the specified following distances.
 *
 * @param rect rectangle to move
 * @param dx delta x
 * @param dy delta y
 */
public void translateRectangle(Rectangle rect, float dx, float dy) {
  float width = rect.getWidth();
  float height = rect.getHeight();
  rect.setLeft(rect.getLeft() + dx);
  rect.setBottom(rect.getBottom() + dy);
  rect.setRight(rect.getLeft() + dx + width);
  rect.setTop(rect.getBottom() + dy + height);
}

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

/**
 * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
 * to appropriately align the contents vertically.
 * @param value
 */
public void setBottom(float value) {
  super.setBottom(value);
  float firstLineRealHeight = firstLineRealHeight();
  float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
  float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
  nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
  float interiorHeight = totalHeight - nonContentHeight;
  float extraHeight = 0.0f;
  switch (verticalAlignment) {
    case Element.ALIGN_BOTTOM:
      extraHeight = interiorHeight - contentHeight;
      break;
    case Element.ALIGN_MIDDLE:
      extraHeight = (interiorHeight - contentHeight) / 2.0f;
      break;
    default:    // ALIGN_TOP
      extraHeight = 0f;
  }
  extraHeight += cellpadding() + cellspacing();
  extraHeight += getBorderWidthInside(TOP);
  if (firstLine != null) {
    firstLine.height = firstLineRealHeight + extraHeight;
  }
}

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

/**
 * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
 * to appropriately align the contents vertically.
 * @param value
 */
public void setBottom(float value) {
  super.setBottom(value);
  float firstLineRealHeight = firstLineRealHeight();
  float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
  float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
  nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
  float interiorHeight = totalHeight - nonContentHeight;
  float extraHeight = 0.0f;
  switch (verticalAlignment) {
    case Element.ALIGN_BOTTOM:
      extraHeight = interiorHeight - contentHeight;
      break;
    case Element.ALIGN_MIDDLE:
      extraHeight = (interiorHeight - contentHeight) / 2.0f;
      break;
    default:    // ALIGN_TOP
      extraHeight = 0f;
  }
  extraHeight += cellpadding() + cellspacing();
  extraHeight += getBorderWidthInside(TOP);
  if (firstLine != null) {
    firstLine.height = firstLineRealHeight + extraHeight;
  }
}

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

/**
 * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
 * to appropriately align the contents vertically.
 * @param value
 */
public void setBottom(float value) {
  super.setBottom(value);
  float firstLineRealHeight = firstLineRealHeight();
  float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
  float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
  nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);
  float interiorHeight = totalHeight - nonContentHeight;
  float extraHeight = 0.0f;
  switch (verticalAlignment) {
    case Element.ALIGN_BOTTOM:
      extraHeight = interiorHeight - contentHeight;
      break;
    case Element.ALIGN_MIDDLE:
      extraHeight = (interiorHeight - contentHeight) / 2.0f;
      break;
    default:    // ALIGN_TOP
      extraHeight = 0f;
  }
  extraHeight += cellpadding() + cellspacing();
  extraHeight += getBorderWidthInside(TOP);
  if (firstLine != null) {
    firstLine.height = firstLineRealHeight + extraHeight;
  }
}

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

/**
 * Gets a Rectangle that is altered to fit on the page.
 *
 * @param    top        the top position
 * @param    bottom    the bottom position
 * @return    a <CODE>Rectangle</CODE>
 */
public Rectangle rectangle(float top, float bottom) {
  Rectangle tmp = new Rectangle(getLeft(), getBottom(), getRight(), getTop());
  tmp.cloneNonPositionParameters(this);
  if (getTop() > top) {
    tmp.setTop(top);
    tmp.setBorder(border - (border & TOP));
  }
  if (getBottom() < bottom) {
    tmp.setBottom(bottom);
    tmp.setBorder(border - (border & BOTTOM));
  }
  return tmp;
}

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

/**
 * Gets a Rectangle that is altered to fit on the page.
 *
 * @param    top        the top position
 * @param    bottom    the bottom position
 * @return    a <CODE>Rectangle</CODE>
 */
public Rectangle rectangle(float top, float bottom) {
  Rectangle tmp = new Rectangle(getLeft(), getBottom(), getRight(), getTop());
  tmp.cloneNonPositionParameters(this);
  if (getTop() > top) {
    tmp.setTop(top);
    tmp.setBorder(border - (border & TOP));
  }
  if (getBottom() < bottom) {
    tmp.setBottom(bottom);
    tmp.setBorder(border - (border & BOTTOM));
  }
  return tmp;
}

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

/**
 * Gets a Rectangle that is altered to fit on the page.
 *
 * @param    top        the top position
 * @param    bottom    the bottom position
 * @return    a <CODE>Rectangle</CODE>
 */
public Rectangle rectangle(float top, float bottom) {
  Rectangle tmp = new Rectangle(getLeft(), getBottom(), getRight(), getTop());
  tmp.cloneNonPositionParameters(this);
  if (getTop() > top) {
    tmp.setTop(top);
    tmp.setBorder(border - (border & TOP));
  }
  if (getBottom() < bottom) {
    tmp.setBottom(bottom);
    tmp.setBorder(border - (border & BOTTOM));
  }
  return tmp;
}

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

/**
 * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
 */
public void onGenericTag(PdfWriter writer, Document document,
    Rectangle rect, String text) {
  rect.setBottom(rect.getBottom() - 3);
  PdfFormField field = (PdfFormField) genericChunkFields.get(text);
  if (field == null) {
    TextField tf = new TextField(writer, new Rectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)), text);
    tf.setFontSize(14);
    try {
      field = tf.getTextField();
    } catch (Exception e) {
      throw new ExceptionConverter(e);
    }
  }
  else {
    field.put(PdfName.RECT,  new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
  }
  if (parent == null)
    writer.addAnnotation(field);
  else
    parent.addKid(field);
}

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

/**
 * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
 */
public void onGenericTag(PdfWriter writer, Document document,
    Rectangle rect, String text) {
  rect.setBottom(rect.getBottom() - 3);
  PdfFormField field = (PdfFormField) genericChunkFields.get(text);
  if (field == null) {
    TextField tf = new TextField(writer, new Rectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)), text);
    tf.setFontSize(14);
    try {
      field = tf.getTextField();
    } catch (Exception e) {
      throw new ExceptionConverter(e);
    }
  }
  else {
    field.put(PdfName.RECT,  new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
  }
  if (parent == null)
    writer.addAnnotation(field);
  else
    parent.addKid(field);
}

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

/**
 * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
 */
public void onGenericTag(PdfWriter writer, Document document,
    Rectangle rect, String text) {
  rect.setBottom(rect.getBottom() - 3);
  PdfFormField field = (PdfFormField) genericChunkFields.get(text);
  if (field == null) {
    TextField tf = new TextField(writer, new Rectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)), text);
    tf.setFontSize(14);
    try {
      field = tf.getTextField();
    } catch (Exception e) {
      throw new ExceptionConverter(e);
    }
  }
  else {
    field.put(PdfName.RECT,  new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
  }
  if (parent == null)
    writer.addAnnotation(field);
  else
    parent.addKid(field);
}

相关文章

微信公众号

最新文章

更多