本文整理汇总了Java中com.itextpdf.text.pdf.PdfPCell.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java PdfPCell.setBorder方法的具体用法?Java PdfPCell.setBorder怎么用?Java PdfPCell.setBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.itextpdf.text.pdf.PdfPCell
的用法示例。
在下文中一共展示了PdfPCell.setBorder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFillCell
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPCell getFillCell(){
PdfPCell fillCell = new PdfPCell();
fillCell.setBorderWidth( 0f );
fillCell.setLeft(0);
fillCell.setTop(0);
fillCell.setRight( 0 );
fillCell.setBottom( 0 );
fillCell.setUseAscender( true );
fillCell.setIndent(0);
fillCell.setHorizontalAlignment( Element.ALIGN_LEFT );
fillCell.setVerticalAlignment( Element.ALIGN_BOTTOM );
fillCell.setPaddingLeft( 0f);
fillCell.setPaddingBottom(0f);
fillCell.setPaddingRight(0f );
fillCell.setPaddingTop( 0f );
fillCell.setBorder( 0 );
renderEmptyCell(fillCell);
return fillCell;
}
示例2: buildPdfPCell
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell buildPdfPCell(HeaderFooter phf,String text,int type){
PdfPCell cell=new PdfPCell();
cell.setPadding(0);
cell.setBorder(Rectangle.NO_BORDER);
Font font=FontBuilder.getFont(phf.getFontFamily(), phf.getFontSize(), phf.isBold(), phf.isItalic(),phf.isUnderline());
String fontColor=phf.getForecolor();
if(StringUtils.isNotEmpty(fontColor)){
String[] color=fontColor.split(",");
font.setColor(Integer.valueOf(color[0]), Integer.valueOf(color[1]), Integer.valueOf(color[2]));
}
Paragraph graph=new Paragraph(text,font);
cell.setPhrase(graph);
switch(type){
case 1:
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
break;
case 2:
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
break;
case 3:
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
break;
}
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
return cell;
}
示例3: getPhotoCell
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private static PdfPCell getPhotoCell(BufferedImage bufferedImage, float scalePercent, boolean isHorizontallyCentered) throws BadElementException, IOException {
Image jpeg = Image.getInstance(bufferedImage, null);
jpeg.scalePercent(scalePercent);
jpeg.setAlignment(Image.MIDDLE);
PdfPCell photoCell = new PdfPCell(jpeg);
photoCell.setBorder(0);
if (isHorizontallyCentered) {
photoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
} else {
photoCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
}
photoCell.setVerticalAlignment(Element.ALIGN_TOP);
int height = (int) Math.ceil(bufferedImage.getHeight() * scalePercent / 100);
photoCell.setFixedHeight(height);
return photoCell;
}
示例4: createCell
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPCell createCell(String value, Font font, int align, int colspan, boolean boderFlag) {
PdfPCell cell = new PdfPCell();
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setHorizontalAlignment(align);
cell.setColspan(colspan);
cell.setPhrase(new Phrase(value, font));
cell.setPadding(3.0f);
if (!boderFlag) {
cell.setBorder(0);
cell.setPaddingTop(15.0f);
cell.setPaddingBottom(8.0f);
}
return cell;
}
示例5: createCell
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPCell createCell( Block block ){
float[] margins = block.getMargins();
PdfPCell cell = new PdfPCell();
cell.setBorderWidth(0);
cell.setVerticalAlignment( VerticalAlign.getByName(block.getVerticalAlign()).getAlignment() );
cell.setLeft(0);
cell.setTop(0);
cell.setRight(0);
cell.setBottom(0);
cell.setUseAscender( block.isUseAscender() );
cell.setIndent(0);
cell.setPaddingLeft( SizeFactory.millimetersToPostscriptPoints( margins[0]) );
cell.setPaddingBottom( SizeFactory.millimetersToPostscriptPoints(margins[3]) );
cell.setPaddingRight( SizeFactory.millimetersToPostscriptPoints(margins[1]) );
cell.setPaddingTop( SizeFactory.millimetersToPostscriptPoints(margins[2]) );
cell.setFixedHeight(SizeFactory.millimetersToPostscriptPoints( block.getPosition()[3] ));
cell.setBorder(0);
cell.setCellEvent( new CellBlockEvent().createEvent(block));
cell.setRotation( block.getRotation() );
return cell;
}
示例6: createLawTable
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPTable createLawTable(PdfContentByte cb) throws DocumentException {
PdfPTable table = new PdfPTable(1);
float[] rows = { 445f };
table.setTotalWidth(rows);
table.getDefaultCell()
.setBorder(Rectangle.NO_BORDER);
table.getDefaultCell()
.setLeading(8f, 0);
table.addCell(new Phrase(new Chunk("Es handelt sich nicht um den Verzicht auf Erstattung von Aufwendungen.", textFontLawText)));
table.addCell(new Phrase(new Chunk("Die Gesellschaft ist wegen Förderung (begünstigter Zweck: Umweltschutz (§52 (2) S. 1 Nr.(n) 8 AO)) durch", textFontLawText)));
table.addCell(new Phrase(new Chunk("Bescheinigung des Finanzamt Halle (Saale)-Nord, StNr. 110/108/91169, vom 19.11.2008 ab 01.01.2009", textFontLawText)));
table.addCell(new Phrase(new Chunk("als gemeinnützig anerkannt. Letzter Freistellungsbescheid datiert auf den 20.06.2013.", textFontLawText)));
table.addCell(new Phrase(new Chunk("Es wird bestätigt, dass die Zuwendung nur zur Förderung des Umweltschutzes verwendet wird.", textFontLawText)));
PdfPCell emptyCell = new PdfPCell();
emptyCell.setBorder(Rectangle.BOTTOM);
emptyCell.setFixedHeight(15f);
table.addCell(emptyCell);
return table;
}
示例7: putSignature
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void putSignature(PdfPTable table, Context context) throws Exception {
String uploadOid = (String)context.get("uploadSignatureOid");
if ( StringUtils.isBlank(uploadOid) ) {
return;
}
byte[] imageBytes = UploadSupportUtils.getDataBytes( uploadOid );
if ( null == imageBytes ) {
return;
}
Image signatureImgObj = Image.getInstance( imageBytes );
signatureImgObj.setWidthPercentage(40f);
PdfPCell cell = new PdfPCell();
cell.setBorder( Rectangle.NO_BORDER );
cell.addElement(signatureImgObj);
table.addCell(cell);
}
示例8: onEndPage
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
/**
* Adds a header to every page
* @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(
* com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document)
*/
public void onEndPage(PdfWriter writer, Document document) {
PdfPTable table = new PdfPTable(3);
try {
table.setWidths(new int[]{40,5,10});
table.setTotalWidth(100);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
Font font=new Font(chineseFont,8);
font.setColor(new BaseColor(55,55,55));
Paragraph paragraph=new Paragraph("第 "+writer.getPageNumber()+" 页 共",font);
paragraph.setAlignment(Element.ALIGN_RIGHT);
table.addCell(paragraph);
Image img=Image.getInstance(total);
img.scaleAbsolute(28, 28);
PdfPCell cell = new PdfPCell(img);
cell.setBorder(Rectangle.NO_BORDER);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(cell);
PdfPCell c = new PdfPCell(new Paragraph("页",font));
c.setHorizontalAlignment(Element.ALIGN_LEFT);
c.setBorder(Rectangle.NO_BORDER);
table.addCell(c);
float center=(document.getPageSize().getWidth())/2-120/2;
table.writeSelectedRows(0, -1,center,30, writer.getDirectContent());
}
catch(DocumentException de) {
throw new ExceptionConverter(de);
}
}
示例9: addCell
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public void addCell(PdfPCell cell) {
cell.setBorder(borderwidth);
cell.setNoWrap(false);
cell.setFixedHeight(margins.getLabelHeight());
//cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//cell.setVerticalAlignment(Element.ALIGN_TOP);
if(curX != 0)
{
PdfPCell gapcell = new PdfPCell();
gapcell.setBorder(borderwidth);
table.addCell(gapcell);
}
curX++;
table.addCell(cell);
if(curX == nAcross)
//table.completeRow();
curX = 0;
}
示例10: generateMapImage
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateMapImage() throws IOException, DocumentException {
PdfPCell cell = new PdfPCell(imageMap(data.mapUrl), true);
cell.setBorder(0);
cell.setPaddingTop(10);
cell.setPaddingBottom(10);
cell.setPaddingLeft(5);
cell.setColspan(6);
return cell;
}
示例11: generateFooter
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPTable generateFooter() {
try {
BaseFont baseFont = BaseFont.createFont(/*"resources/ARIAL.TTF"*/ "c:/Windows/Fonts/arial.ttf", BaseFont.IDENTITY_H, true);
footerTable = new PdfPTable(1);
footerTable.setTotalWidth(440);
footerTable.setLockedWidth(true);
Font pageNumberFont = new Font(baseFont, 9, Font.BOLD);
Paragraph pageNumberP = new Paragraph(titleIndex+"-"+ pageNumber, pageNumberFont);
PdfPCell pageNumberCell = new PdfPCell(pageNumberP);
pageNumberCell.setBorder(0);
pageNumberCell.setPaddingTop(20);
footerTable.addCell(pageNumberCell);
} catch (Exception e) {
e.printStackTrace();
}
return footerTable;
}
示例12: generateSectionTitle
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void generateSectionTitle(PdfPTable table, Data data) throws IOException, DocumentException {
if (!this.currentSection.equals(data.mountains)) {
currentSection = data.mountains;
currentBackgroundColor = backgroundColorGenerator.generate(data);
PdfPCell cellSeparator = new PdfPCell(PhraseUtil.phrase(" "));
cellSeparator.setBorder(0);
cellSeparator.setPadding(10);
cellSeparator.setColspan(4);
table.addCell(cellSeparator);
PdfPCell cell = new PdfPCell(PhraseUtil.phrase(currentSection, 14, Font.BOLD));
cell.setBorder(0);
cell.setPadding(10);
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
cell.setColspan(4);
cell.setBackgroundColor(currentBackgroundColor);
table.addCell(cell);
}
}
示例13: tableWithPageNumber
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPTable tableWithPageNumber() throws DocumentException, IOException {
PdfPTable innerTable = new PdfPTable(1);
innerTable.setWidths(new int[]{1});
innerTable.setWidthPercentage(100);
innerTable.setPaddingTop(0);
innerTable.addCell(new PageNumberCellGenerator(pageNumber, BackgroundColorGenerator.DEFAULT_BACKGROUND_COLOR)
.generateTile());
PdfPCell cell = new PdfPCell();
cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBorder(0);
cell.setPadding(0);
cell.addElement(innerTable);
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100f);
table.setWidths(new int[]{1});
table.setExtendLastRow(true);
table.addCell(cell);
return table;
}
示例14: createBarcodeTable
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPTable createBarcodeTable(PdfContentByte cb, String caption, String detail, String code) {
// Barcode Generation
Barcode39 codeEAN = new Barcode39();
codeEAN.setCode(code);
Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);
// Table
PdfPTable table = new PdfPTable(1);
table.setSpacingBefore(10);
table.setSpacingAfter(10);
table.setTotalWidth(80);
table.setLockedWidth(true);
PdfPCell cell1 = new PdfPCell(imageEAN);
PdfPCell cell2 = new PdfPCell(new Paragraph(caption));
PdfPCell cell3 = new PdfPCell(new Paragraph(detail));
cell1.setBorder(Rectangle.NO_BORDER);
cell2.setBorder(Rectangle.NO_BORDER);
cell3.setBorder(Rectangle.NO_BORDER);
table.addCell(cell1);
table.addCell(cell2);
table.addCell(cell3);
return table;
}
示例15: buildHeaderNameLine
import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public static PdfPTable buildHeaderNameLine(String schuelername, Font headerFont) throws DocumentException {
PdfPCell labelCell = new PdfPCell(new Phrase("Name", headerFont));
labelCell.setBorder(Rectangle.BOTTOM);
labelCell.setBorderWidth(1f);
PdfPCell nameCell = new PdfPCell(new Phrase(schuelername, headerFont));
nameCell.setBorder(Rectangle.BOTTOM);
nameCell.setBorderWidth(1f);
nameCell.setColspan(5);
PdfPTable table = prebuildHeaderTable();
table.addCell(labelCell);
table.addCell(nameCell);
return table;
}