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

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

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

Rectangle.getTop介绍

[英]Returns the upper right y-coordinate.
[中]返回右上角的y坐标。

代码示例

代码示例来源:origin: stackoverflow.com

public void onEndPage(PdfWriter writer, Document document)
 {
   Rectangle rect = writer.getBoxSize("art");
   ColumnText.showTextAligned(writer.getDirectContent(),
       Element.ALIGN_RIGHT, new Phrase("My static header text"),
       rect.getRight(), rect.getTop(), 0);
   ColumnText.showTextAligned(writer.getDirectContent(),
       Element.ALIGN_CENTER, new Phrase(String.format("page %d", pagenumber)),
       (rect.getLeft() + rect.getRight()) / 2, rect.getBottom() - 18, 0);
 }

代码示例来源:origin: stackoverflow.com

ColumnText.showTextAligned(writer.getDirectContent(),
      Element.ALIGN_RIGHT, header[0],
      rect.getRight(), rect.getTop(), 0);
  break;
case 1:
  ColumnText.showTextAligned(writer.getDirectContent(),
      Element.ALIGN_LEFT, header[1],
      rect.getLeft(), rect.getTop(), 0);
  break;

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

/**
* Returns the upper right y-coordinate, considering a given margin.
*
  * @param margin
  *            a margin
* @return    the upper right y-coordinate
*/
 
 public float top(float margin) {
   return pageSize.getTop(marginTop + margin);
 }

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

/**
* Returns the upper right y-coordinate, considering a given margin.
*
  * @param margin
  *            a margin
* @return    the upper right y-coordinate
*/
 
 public float top(float margin) {
   return pageSize.getTop(marginTop + margin);
 }

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

/**
 * Returns the upper right y-coordinate.
 *
 * @return        the upper right y-coordinate
 */
public float getTop() {
  return super.getTop(cellspacing);
}

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

/**
* Returns the upper right y-coordinate.
*
* @return    the upper right y-coordinate
*/
 
 public float top() {
   return pageSize.getTop(marginTop);
 }

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

/**
* Returns the upper right y-coordinate, considering a given margin.
*
  * @param margin
  *            a margin
* @return    the upper right y-coordinate
*/
 
 public float top(float margin) {
   return pageSize.getTop(marginTop + margin);
 }

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

/**
 * Returns the upper right y-coordinate.
 *
 * @return        the upper right y-coordinate
 */
public float getTop() {
  return super.getTop(cellspacing);
}

代码示例来源:origin: stackoverflow.com

myPdfWriter.setPageEvent( new PdfPageEventHelper() {
 public void onGenericTag(PdfWriter writer, Document doc, Rectangle chunkRect, String tag ) {
  if ("imgTag".equals(tag)) {
   // Draw your text into that rect.
   ColumnText.showTextAligned(writer.getOverContent(), Element.ALIGN_LEFT, paragraph,
    chunkRect.getLeft() + someOffsetX, chunkRect.getTop() - someOffsetY, 0f );
  }
 }
} );

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

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.google.code.maven-play-plugin.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: com.github.librepdf/openpdf

/**
 * Constructs a <CODE>PdfRectangle</CODE>-object with a <CODE>Rectangle</CODE>-object.
 *
 * @param    rectangle    a <CODE>Rectangle</CODE>
 */

  public PdfRectangle(Rectangle rectangle, int rotation) {
    this(rectangle.getLeft(), rectangle.getBottom(), rectangle.getRight(), rectangle.getTop(), rotation);
  }

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

/**
 * Constructs a <CODE>PdfRectangle</CODE>-object with a <CODE>Rectangle</CODE>-object.
 *
 * @param    rectangle    a <CODE>Rectangle</CODE>
 */

  public PdfRectangle(Rectangle rectangle, int rotation) {
    this(rectangle.getLeft(), rectangle.getBottom(), rectangle.getRight(), rectangle.getTop(), rotation);
  }

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

@Override
public String toString() {
  return getClass().getSimpleName() + " [" + (int) getBounds().getLeft() + " : " + (int) getBounds().getRight()
      + "] x [" + (int) getBounds().getBottom() + " : " + (int) getBounds().getTop() + "]";
}

代码示例来源:origin: stackoverflow.com

public class MyBorder implements PdfPCellEvent {
  public void cellLayout(PdfPCell cell, Rectangle position,
    PdfContentByte[] canvases) {
    float x1 = position.getLeft() + 2;
    float x2 = position.getRight() - 2;
    float y1 = position.getTop() - 2;
    float y2 = position.getBottom() + 2;
    PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
    canvas.rectangle(x1, y1, x2 - x1, y2 - y1);
    canvas.stroke();
  }
}

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

/**
   * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
   */
  public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvases) {
    if (cellField == null || (fieldWriter == null && parent == null)) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("you.have.used.the.wrong.constructor.for.this.fieldpositioningevents.class"));
    cellField.put(PdfName.RECT, new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
    if (parent == null)
      fieldWriter.addAnnotation(cellField);
    else
      parent.addKid(cellField);
  }
}

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

/**
   * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
   */
  public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvases) {
    if (cellField == null || (fieldWriter == null && parent == null)) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("you.have.used.the.wrong.constructor.for.this.fieldpositioningevents.class"));
    cellField.put(PdfName.RECT, new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
    if (parent == null)
      fieldWriter.addAnnotation(cellField);
    else
      parent.addKid(cellField);
  }
}

相关文章

微信公众号

最新文章

更多