本文整理匯總了Java中com.itextpdf.text.Element.ALIGN_LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Element.ALIGN_LEFT屬性的具體用法?Java Element.ALIGN_LEFT怎麽用?Java Element.ALIGN_LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.itextpdf.text.Element
的用法示例。
在下文中一共展示了Element.ALIGN_LEFT屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cellRodape
private PdfPTable cellRodape(String value, boolean l,boolean r,int align)
{
Font fontCorpoTableO= FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED ,7.5f);
PdfPTable pTable = new PdfPTable(1);
pTable.setWidthPercentage(100f);
PdfPCell cellValue = new PdfPCell(new Phrase(value,fontCorpoTableO));
if(l){cellValue.setBorderWidthLeft(0);}
if(r){cellValue.setBorderWidthRight(0);}
switch (align)
{
case Element.ALIGN_RIGHT:cellValue.setHorizontalAlignment(Element.ALIGN_RIGHT);break;
case Element.ALIGN_LEFT:cellValue.setHorizontalAlignment(Element.ALIGN_LEFT);break;
case Element.ALIGN_CENTER:cellValue.setHorizontalAlignment(Element.ALIGN_CENTER);break;
default:break;
}
pTable.addCell(cellValue);
return pTable;
}
示例2: createPdf
public void createPdf(String filename) throws DocumentException, IOException {
Document document = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
// TODO: 1. get direct content
PdfContentByte canvas = writer.getDirectContent();
Font font = new Font(FontFamily.HELVETICA, 18, Font.BOLD, BaseColor.ORANGE);
Phrase headerText = new Phrase("PSEG DP&C", font);
int alignLeft = Element.ALIGN_LEFT;
float right = document.getPageSize().getRight();
float top = document.getPageSize().getTop();
// TODO: 2. use ColumnText
ColumnText.showTextAligned(canvas, alignLeft, headerText, right - 180, top - 36, 0);
document.close();
}
示例3: getDefaultAttributes
/**
* Get the default element attributes used when creating document elements
* @return The set of default element attributes
*/
public static ElementAttributes getDefaultAttributes() {
CellAttributes lCellAttributes = new CellAttributes(true, PdfPCell.NO_BORDER, 0f, null);
FontAttributes lFontAttributes = new FontAttributes(11, Font.NORMAL, BaseColor.BLACK, 1.2f);
ParagraphAttributes lParagraphAttributes = new ParagraphAttributes(Element.ALIGN_LEFT);
TableAttributes lTableAttributes = new TableAttributes(Optional.of(100f), Optional.empty(), Element.ALIGN_LEFT, 0f, 0f, false);
return new ElementAttributes(lCellAttributes, lFontAttributes, lParagraphAttributes, lTableAttributes);
}
示例4: columnAlignment
public int columnAlignment(int col) {
TableColumnNode tcn = tableNodeColumns.get(col);
switch (tcn.getAlignment()) {
case Left:
return Element.ALIGN_LEFT;
case Right:
return Element.ALIGN_RIGHT;
case None:
return Element.ALIGN_UNDEFINED;
case Center:
default:
return Element.ALIGN_CENTER;
}
}
示例5: renderField
@Override
protected void renderField(String content, ColRDesc colRDesc) {
PdfPCell cell = new PdfPCell(new Paragraph(content, pdfStyle.getDataCellFont()));
cell.setColspan(1);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
if (colRDesc != null && colRDesc.getHAlign() != null) {
int alignment = Element.ALIGN_CENTER;
switch (colRDesc.getHAlign()) {
case LEFT:
alignment = Element.ALIGN_LEFT;
break;
case RIGHT:
alignment = Element.ALIGN_RIGHT;
break;
case CENTER:
alignment = Element.ALIGN_CENTER;
break;
default:
break;
}
cell.setHorizontalAlignment(alignment);
}
if (withNoBorders) {
cell.setBorder(Rectangle.NO_BORDER);
}
customizeFieldCell(cell);
table.addCell(cell);
}
示例6: getFooterHorizontalAlignment
/**
* Obtain the footer horizontal alignment; Meant to be overriden if a different style is desired.
* @return The footer horizontal alignment.
*/
protected int getFooterHorizontalAlignment()
{
return Element.ALIGN_LEFT;
}