当前位置: 首页>>代码示例>>Java>>正文


Java Document.bottom方法代码示例

本文整理汇总了Java中com.lowagie.text.Document.bottom方法的典型用法代码示例。如果您正苦于以下问题:Java Document.bottom方法的具体用法?Java Document.bottom怎么用?Java Document.bottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lowagie.text.Document的用法示例。


在下文中一共展示了Document.bottom方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEndPage

import com.lowagie.text.Document; //导入方法依赖的package包/类
public void onEndPage(PdfWriter writer, Document document) {
	//Footer contains page numbers and date printed on all pages
	PdfContentByte cb = writer.getDirectContent();
	cb.saveState();

	String strFooter = promoTxt + " " + formatter.format(now);

	float textBase = document.bottom();
	cb.beginText();
	cb.setFontAndSize(font.getBaseFont(), FONTSIZE);
	Rectangle page = document.getPageSize();
	float width = page.getWidth();
	cb.showTextAligned(PdfContentByte.ALIGN_CENTER, strFooter, (width / 2.0f), textBase - 20, 0);

	strFooter = "-" + writer.getPageNumber() + "-";
	cb.showTextAligned(PdfContentByte.ALIGN_CENTER, strFooter, (width / 2.0f), textBase - 10, 0);

	cb.endText();
	cb.restoreState();
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:21,代码来源:TicklerPrinter.java

示例2: onEndPage

import com.lowagie.text.Document; //导入方法依赖的package包/类
public void onEndPage( PdfWriter writer, Document document ) {
    //Footer contains page numbers and date printed on all pages
    PdfContentByte cb = writer.getDirectContent();
    cb.saveState();

    String strFooter = promoTxt + " " + formatter.format(now);

    float textBase = document.bottom();
    cb.beginText();
    cb.setFontAndSize(font.getBaseFont(),FONTSIZE);
    Rectangle page = document.getPageSize();
    float width = page.getWidth();

    cb.showTextAligned(PdfContentByte.ALIGN_CENTER, strFooter, (width/2.0f), textBase - 20, 0);

    strFooter = "-" + writer.getPageNumber() + "-";
    cb.showTextAligned(PdfContentByte.ALIGN_CENTER, strFooter, (width/2.0f), textBase-10, 0);

    cb.endText();
    cb.restoreState();
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:22,代码来源:OscarChartPrinter.java

示例3: onEndPage

import com.lowagie.text.Document; //导入方法依赖的package包/类
/**
 * Adds promo text, date and current page number to each page
 * 
 * @param writer
 * @param document
 */
public void onEndPage(PdfWriter writer, Document document) {
	PdfContentByte cb = writer.getDirectContent();
	cb.saveState();

	float textBase = document.bottom() - getBaseOffset();
	float width = document.getPageSize().getWidth();
	float center = width / 2.0f;

	cb.beginText();
	cb.setFontAndSize(getFont(), getFontSize());

	cb.setTextMatrix(document.left(), textBase);
	cb.showTextAligned(PdfContentByte.ALIGN_CENTER, text, center, textBase, 0);
	cb.endText();
	cb.restoreState();
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:23,代码来源:PromoTextStamper.java

示例4: onEndPage

import com.lowagie.text.Document; //导入方法依赖的package包/类
public void onEndPage(PdfWriter writer, Document document) {
	PdfContentByte cb = writer.getDirectContent();
	cb.saveState();

	String text = "Page " + writer.getPageNumber() + " of ";

	// height where text starts 
	float textBase = document.bottom() - getBaseOffset();
	float textSize = getFont().getWidthPoint(text, getFontSize());
	float width = document.getPageSize().getWidth();
	float center = width / 2.0f;

	cb.beginText();
	cb.setFontAndSize(getFont(), getFontSize());

	cb.setTextMatrix(document.left(), textBase);
	cb.showTextAligned(PdfContentByte.ALIGN_CENTER, text, center, textBase, 0);
	cb.endText();
	cb.addTemplate(total, center + (textSize / 2.0f), textBase);

	cb.restoreState();
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:23,代码来源:PageNumberStamper.java

示例5: onEndPage

import com.lowagie.text.Document; //导入方法依赖的package包/类
public void onEndPage( PdfWriter writer, Document document ) {
    //Footer contains page numbers and date printed on all pages
    PdfContentByte cb = writer.getDirectContent();
    cb.saveState();

    String strFooter = promoTxt + " " + formatter.format(now);

    float textBase = document.bottom();
    cb.beginText();
    cb.setFontAndSize(font.getBaseFont(),FONTSIZE);
    Rectangle page = document.getPageSize();
    float width = page.getWidth();            
    cb.showTextAligned(PdfContentByte.ALIGN_CENTER, strFooter, (width/2.0f), textBase - 20, 0);

    strFooter = "-" + writer.getPageNumber() + "-";
    cb.showTextAligned(PdfContentByte.ALIGN_CENTER, strFooter, (width/2.0f), textBase-10, 0);

    cb.endText();
    cb.restoreState();
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:21,代码来源:PdfRecordPrinter.java

示例6: onEndPage

import com.lowagie.text.Document; //导入方法依赖的package包/类
/**
 * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
    PdfContentByte cb = writer.getDirectContent();
    cb.saveState();
    // write the headertable
    table.setTotalWidth(document.right() - document.left());
    table.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 50, cb);
    // compose the footer
    String text = "Page " + writer.getPageNumber() + " of ";
    float textSize = helv.getWidthPoint(text, 12);
    float textBase = document.bottom() - 20;
    cb.beginText();
    cb.setFontAndSize(helv, 12);
    // for odd pagenumbers, show the footer at the left
    if ((writer.getPageNumber() & 1) == 1) {
        cb.setTextMatrix(document.left(), textBase);
        cb.showText(text);
        cb.endText();
        cb.addTemplate(tpl, document.left() + textSize, textBase);
    }
    // for even numbers, show the footer at the right
    else {
        float adjust = helv.getWidthPoint("0", 12);
        cb.setTextMatrix(document.right() - textSize - adjust, textBase);
        cb.showText(text);
        cb.endText();
        cb.addTemplate(tpl, document.right() - adjust, textBase);
    }

    // draw a Rectangle around the page
    cb.setColorStroke(Color.orange);
    cb.setLineWidth(2);
    cb.rectangle(20, 20, document.getPageSize().getWidth() - 40, document.getPageSize().getHeight() - 40);
    cb.stroke();

    // starting on page 3, a watermark with an Image that is made transparent
    if (writer.getPageNumber() >= 3) {

        cb.setGState(gstate);
        cb.setColorFill(Color.red);
        cb.beginText();
        cb.setFontAndSize(helv, 48);
        cb.showTextAligned(Element.ALIGN_CENTER, "Watermark Opacity " + writer.getPageNumber(), document.getPageSize().getWidth() / 2, document.getPageSize().getHeight() / 2, 45);
        cb.endText();
        try {
            cb.addImage(headerImage, headerImage.getWidth(), 0, 0, headerImage.getHeight(), 440, 80);
        }
        catch(Exception e) {
            throw new ExceptionConverter(e);
        }
    }
    cb.restoreState();
    cb.sanityCheck();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:57,代码来源:PageNumbersWatermarkTest.java

示例7: onFinPagina2

import com.lowagie.text.Document; //导入方法依赖的package包/类
private void onFinPagina2(PdfWriter writer, Document document) {
	Rectangle page = document.getPageSize();
          PdfContentByte cb = writer.getDirectContent();
          
          Font font = new Font(Font.HELVETICA, 7, Font.ITALIC, Color.GRAY);
          
          
          if (cabecera != null){
           PdfPTable head = new PdfPTable(1);	            
           head.getDefaultCell().setBorder(Rectangle.NO_BORDER);
           head.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);	            
           Paragraph bloque = new Paragraph(new Chunk(cabecera,font));
           head.addCell(bloque);
           head.addCell(new Phrase(new Chunk("",font)));
           head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin());
           head.writeSelectedRows(0, -1, document.leftMargin(), page.height() - document.topMargin() + head.getTotalHeight(),writer.getDirectContent());
          }            
          
          // Texto de pie y c�digo de barras
          if (pie == null) pie = "";
      	
          
          /** VRS: cambio para a�adir paginacion */
          cb.saveState();
          String text = pie + "  -  P�g. " + writer.getPageNumber() + " de ";
  		float textBase = document.bottom() - 20;
  		float textSize = bFont.getWidthPoint(text, 7);
  		
  		
  		cb.saveState();
  		cb.beginText();
  		cb.setFontAndSize(bFont, 7);
  		
  		
	float adjust = bFont.getWidthPoint("0", 7);
	cb.setTextMatrix(document.right() - textSize - adjust, textBase);
	cb.setColorFill(Color.GRAY);
	cb.showText(text);
	cb.endText();
	cb.addTemplate(tplTotal, document.right() - adjust, textBase);
  		
  		cb.restoreState();
  		

}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:46,代码来源:PDFDocument.java


注:本文中的com.lowagie.text.Document.bottom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。