本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}