本文整理汇总了Java中com.itextpdf.text.pdf.PdfPCell类的典型用法代码示例。如果您正苦于以下问题:Java PdfPCell类的具体用法?Java PdfPCell怎么用?Java PdfPCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PdfPCell类属于com.itextpdf.text.pdf包,在下文中一共展示了PdfPCell类的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: cellRodape
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
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;
}
示例3: generatePage
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
@Override
public PdfPTable generatePage() throws Exception {
Image image = Image.getInstance(imageFile.toURL());
float heightToWidthRatio = (210f / 297f);
Image imageCropped = ImageUtils.cropImageToMeetRatio(pdfWriter, image, heightToWidthRatio);
PdfPCell cell = new PdfPCell(imageCropped, true);
cell.setBorder(0);
cell.setPadding(COVER_MARGIN);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setExtraParagraphSpace(0);
cell.setRightIndent(0);
PdfPTable table = new PdfPTable(1);
;
table.setWidthPercentage(100f);
table.setWidths(new int[]{1});
table.setExtendLastRow(true);
table.addCell(cell);
return table;
}
示例4: 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;
}
示例5: createGridColumnHeader
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
private void createGridColumnHeader(PdfPTable table, Collection<ColumnHeader> topHeaders, int maxHeaderLevel) throws Exception {
for (int i = 1; i < 50; i++) {
List<ColumnHeader> result = new ArrayList<ColumnHeader>();
generateGridHeadersByLevel(topHeaders, i, result);
for (ColumnHeader header : result) {
PdfPCell cell = new PdfPCell(createParagraph(header));
if (header.getBgColor() != null) {
int[] colors = header.getBgColor();
cell.setBackgroundColor(new BaseColor(colors[0], colors[1], colors[2]));
}
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setHorizontalAlignment(header.getAlign());
cell.setColspan(header.getColspan());
if (header.getColumnHeaders().size() == 0) {
int rowspan = maxHeaderLevel - (header.getLevel() - 1);
if (rowspan > 0) {
cell.setRowspan(rowspan);
}
}
table.addCell(cell);
}
}
}
示例6: serialise
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
/**
* Serialise the input field div and content
* @param pSerialisationContext
* @param pSerialiser
* @param pEvalNode
*/
public void serialise(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EN pEvalNode) {
ElementAttributes lElementAttributes = pSerialiser.getInheritedElementAttributes();
pSerialiser.getCSSResolver().resolveStyles(lElementAttributes, INPUT_FIELD_TAG, getInputFieldClasses(), Collections.emptyList());
pSerialiser.pushElementAttributes(lElementAttributes);
PdfPTable lTable = pSerialiser.getElementFactory().getTable(1);
PdfPCell lCell = pSerialiser.getElementFactory().getCell();
Paragraph lCellParagraph = pSerialiser.getElementFactory().getParagraph();
pSerialiser.startContainer(ElementContainerFactory.getContainer(lCell, lCellParagraph));
mInputFieldContent.addContent(pSerialisationContext, pSerialiser, pEvalNode);
if (lCellParagraph.isEmpty()) {
// If there is no cell content in all cells in a table row, the row will be 0 height - add a zero width space to
// ensure that the input field div isn't collapsed like this (the height will be determined from the cell
// paragraph font)
lCellParagraph.add(ZERO_WIDTH_SPACE_CHARACTER);
}
pSerialiser.endContainer();
lTable.addCell(lCell);
pSerialiser.add(lTable);
pSerialiser.popElementAttributes();
}
示例7: 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;
}
示例8: createGridTableDatas
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
private void createGridTableDatas(PdfPTable table, Collection<ReportData> datas) {
for (ReportData data : datas) {
PdfPCell cell = new PdfPCell(createParagraph(data.getTextChunk()));
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
int level = this.calculateIndentationCount(data.getTextChunk().getText());
if (data.getBgColor() != null) {
int[] colors = data.getBgColor();
cell.setBackgroundColor(new BaseColor(colors[0], colors[1], colors[2]));
}
if (level == 0) {
cell.setHorizontalAlignment(data.getAlign());
} else {
cell.setIndent(20 * level);
}
table.addCell(cell);
}
}
示例9: 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;
}
示例10: 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;
}
示例11: onRender
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
public void onRender(PdfPCell cell ) throws PdfRenderException{
com.itextpdf.text.Paragraph pr = new com.itextpdf.text.Paragraph();
pr.setLeading( leading );
pr.setExtraParagraphSpace(0);
pr.setAlignment( HorizontalAlign.getByName(horizontalAlign).getAlignment() );
pr.setIndentationLeft( indent.getLeft() );
pr.setFirstLineIndent( indent.getFirst() );
pr.setIndentationRight( indent.getRight() );
pr.setSpacingBefore(0);
pr.setSpacingAfter(0);
if( phrases != null ){
for( AbstractPhrase phrase : phrases ){
phrase.onRender( pr );
}
}
cell.addElement( pr );
}
示例12: createAccomodationTableHeaders
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
private void createAccomodationTableHeaders(PdfPTable accomodationsTable) {
PdfPCell numberHeader = new PdfPCell(new Paragraph("Lp."));
PdfPCell roomNumberHeader = new PdfPCell(new Paragraph("Nr pokoju"));
PdfPCell dateFromHeader = new PdfPCell(new Paragraph("Od"));
PdfPCell dateToHeader = new PdfPCell(new Paragraph("Do"));
PdfPCell placesHeader = new PdfPCell(new Paragraph("Miejsca"));
PdfPCell roomTypeHeader = new PdfPCell(new Paragraph("Typ"));
PdfPCell roomPriceHeader = new PdfPCell(new Paragraph("Cena"));
accomodationsTable.addCell(numberHeader);
accomodationsTable.addCell(roomNumberHeader);
accomodationsTable.addCell(dateFromHeader);
accomodationsTable.addCell(dateToHeader);
accomodationsTable.addCell(placesHeader);
accomodationsTable.addCell(roomTypeHeader);
accomodationsTable.addCell(roomPriceHeader);
}
示例13: createofferInstancesTableContent
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
private void createofferInstancesTableContent(List<OfferInstance> offerInstances, PdfPTable offerInstancesTable) {
DecimalFormat decimalFormat = new DecimalFormat(PRICE_DECIMAL_FORMAT);
int i = 1;
for (OfferInstance offerInstance : offerInstances) {
Offer offer = offerInstance.getOffer();
PdfPCell numberCell = new PdfPCell(new Paragraph(String.valueOf(i++)));
String offerName = offer.getName();
PdfPCell roomNumberCell = new PdfPCell(new Paragraph(offerName));
String offerPrice = decimalFormat.format(offer.getBaseValue()) + " PLN";
PdfPCell roomPriceCell = new PdfPCell(new Paragraph(offerPrice));
offerInstancesTable.addCell(numberCell);
offerInstancesTable.addCell(roomNumberCell);
offerInstancesTable.addCell(roomPriceCell);
}
}
示例14: createTableContent
import com.itextpdf.text.pdf.PdfPCell; //导入依赖的package包/类
private void createTableContent(List<CleaningSchedule> cleaningSchedules, PdfPTable cleaningScheduleTable) {
int i = 1;
for (CleaningSchedule cleaningSchedule : cleaningSchedules) {
PdfPCell numberCell = new PdfPCell(new Paragraph(String.valueOf(i++)));
String roomNumber = cleaningSchedule.getAccomodation().getAllocationEntity().getNumber();
PdfPCell roomNumberCell = new PdfPCell(new Paragraph(roomNumber));
String preferredTime = cleaningSchedule.getDesiredTime() == null ? "-" : cleaningSchedule.getDesiredTime().toString("HH:mm");
PdfPCell preferredTimeCell = new PdfPCell(new Paragraph(preferredTime));
String note = cleaningSchedule.getNote() == null ? "-" : cleaningSchedule.getNote();
PdfPCell noteCell = new PdfPCell(new Paragraph(note));
cleaningScheduleTable.addCell(numberCell);
cleaningScheduleTable.addCell(roomNumberCell);
cleaningScheduleTable.addCell(preferredTimeCell);
cleaningScheduleTable.addCell(noteCell);
}
}
示例15: 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);
}