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


Java PdfPCell.setPadding方法代码示例

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


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

示例1: 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;
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:24,代码来源:CoverPageGenerator.java

示例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;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:27,代码来源:PageHeaderFooterEvent.java

示例3: 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;
}
 
开发者ID:melonlee,项目名称:PowerApi,代码行数:15,代码来源:PDFTest.java

示例4: 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);
    }
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:21,代码来源:TableOfContentsPageGenerator.java

示例5: 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;
    }
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:24,代码来源:EmptyPageGenerator.java

示例6: generateFooter

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateFooter() throws IOException, DocumentException, URISyntaxException {

        PdfPCell cell = new PdfPCell();
        cell.setColspan(12);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        cell.setPadding(0);

        PdfPTable innerTable = new PdfPTable(2);
        innerTable.getDefaultCell().setBorder(0);
        innerTable.setWidths(new int[]{1, 1});
        innerTable.setWidthPercentage(100);
        innerTable.addCell(generateStamp());
        innerTable.addCell(new PageNumberCellGenerator(pageNumber, backgroundColor).generateTile());

        cell.addElement(innerTable);
        return cell;
    }
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:20,代码来源:DataPageGenerator.java

示例7: generateAuthorCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateAuthorCell() throws IOException, DocumentException {
    PdfPCell cell = new PdfPCell(PhraseUtil.phrase(
            "............................................\nImię i nazwisko", 15, Font.NORMAL));
    cell.setBorder(0);
    cell.setPadding(10);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
    cell.setBackgroundColor(BackgroundColorGenerator.DEFAULT_BACKGROUND_COLOR);
    return cell;
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:11,代码来源:FirstPageGenerator.java

示例8: generateStamp

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell generateStamp() throws IOException, DocumentException, URISyntaxException {

        PdfPTable stampTable = new PdfPTable(2);
        stampTable.setWidths(new float[] {1,12});

        PdfPCell cellIcon = new PdfPCell(ImageUtils.readImageFromResources("icons/check.png"));
        cellIcon.setFixedHeight(10);
        cellIcon.setPadding(2);
        cellIcon.setBorder(0);
        cellIcon.setBackgroundColor(backgroundColor);

        PdfPCell cellText = new PdfPCell(phrase("Data i pieczątka"));
        cellText.setHorizontalAlignment(Element.ALIGN_LEFT);
        cellText.setVerticalAlignment(Element.ALIGN_CENTER);
        cellText.setBorder(0);
        cellText.setBackgroundColor(backgroundColor);
        cellText.setPadding(0);
        cellText.setPaddingTop(5);
        cellText.setPaddingLeft(5);

        stampTable.addCell(cellIcon);
        stampTable.addCell(cellText);

        PdfPCell stampCell = new PdfPCell(stampTable);
        stampCell.setPadding(0);
        stampCell.setBorder(0);
        return stampCell;
    }
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:29,代码来源:DataPageGenerator.java

示例9: generateTile

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPCell generateTile() throws IOException, DocumentException {
    PdfPCell cell = new PdfPCell(PhraseUtil.phrase("- " + pageNumber + " -"));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setVerticalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setPadding(5);
    cell.setPaddingRight(10);
    cell.setPaddingBottom(9);
    cell.setBackgroundColor(backgroundColor);
    return cell;
}
 
开发者ID:lenrok258,项目名称:MountainQuest-PL,代码行数:12,代码来源:PageNumberCellGenerator.java

示例10: getCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
public PdfPCell getCell(String text, int alignment) {
    PdfPCell cell = new PdfPCell(new Phrase(text));
    cell.setPadding(0);
    cell.setHorizontalAlignment(alignment);
    //cell.setBorder(PdfPCell.NO_BORDER);
    return cell;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:8,代码来源:RecordCard.java

示例11: getCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
/**
 * Returns a formatted cell for the given value.
 * @param value cell value
 * @return Cell
 */
private PdfPCell getCell(String value)
{
    PdfPCell cell = new PdfPCell(new Phrase(new Chunk(StringUtils.trimToEmpty(value), smallFont)));
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setLeading(8, 0);
    cell.setPadding(2);
    return cell;
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:14,代码来源:PdfView.java

示例12: setStyleRodape

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private void setStyleRodape(PdfPCell cellRodape) {
    cellRodape.setBorderWidthBottom(0.5f);
    cellRodape.setPadding(2f);
    cellRodape.setPaddingLeft(0.8f);
    cellRodape.setPaddingRight(0.8f);
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:7,代码来源:ExporOnlyViagemPdf.java

示例13: cellEspecial

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private static PdfPTable cellEspecial(PdfPCell cellEspcial) {
    PdfPTable pTable = new PdfPTable(1);
    pTable.addCell(cellEspcial);
    cellEspcial.setPadding(3f);
    return pTable;
}
 
开发者ID:JIGAsoftSTP,项目名称:NICON,代码行数:7,代码来源:ExportViagemSemanaExcel.java

示例14: buildPdfPCell

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
private PdfPCell buildPdfPCell(Cell cellInfo,int cellHeight) throws Exception{
	CellStyle style=cellInfo.getCellStyle(); 
	CellStyle customStyle=cellInfo.getCustomCellStyle();
	CellStyle rowStyle=cellInfo.getRow().getCustomCellStyle();
	CellStyle colStyle=cellInfo.getColumn().getCustomCellStyle();
	PdfPCell cell=newPdfCell(cellInfo,cellHeight);
	cell.setPadding(0);
	cell.setBorder(PdfPCell.NO_BORDER);
	cell.setCellEvent(new CellBorderEvent(style,customStyle));
	int rowSpan=cellInfo.getPageRowSpan();
	if(rowSpan>0){
		cell.setRowspan(rowSpan);
	}
	int colSpan=cellInfo.getColSpan();
	if(colSpan>0){
		cell.setColspan(colSpan);
	}
	Alignment align=style.getAlign();
	if(customStyle!=null && customStyle.getAlign()!=null){
		align=customStyle.getAlign();
	}
	if(rowStyle!=null && rowStyle.getAlign()!=null){
		align=rowStyle.getAlign();
	}
	if(colStyle!=null && colStyle.getAlign()!=null){
		align=colStyle.getAlign();
	}
	if(align!=null){
		if(align.equals(Alignment.left)){
			cell.setHorizontalAlignment(Element.ALIGN_LEFT);
		}else if(align.equals(Alignment.center)){
			cell.setHorizontalAlignment(Element.ALIGN_CENTER);
		}else if(align.equals(Alignment.right)){
			cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
		}
	}
	Alignment valign=style.getValign();
	if(customStyle!=null && customStyle.getValign()!=null){
		valign=customStyle.getValign();
	}
	if(rowStyle!=null && rowStyle.getValign()!=null){
		valign=rowStyle.getValign();
	}
	if(colStyle!=null && colStyle.getValign()!=null){
		valign=colStyle.getValign();
	}
	if(valign!=null){
		if(valign.equals(Alignment.top)){
			cell.setVerticalAlignment(Element.ALIGN_TOP);
		}else if(valign.equals(Alignment.middle)){
			cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
		}else if(valign.equals(Alignment.bottom)){
			cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
		}
	}
	String bgcolor=style.getBgcolor();
	if(customStyle!=null && StringUtils.isNotBlank(customStyle.getBgcolor())){
		bgcolor=customStyle.getBgcolor();
	}
	if(rowStyle!=null && StringUtils.isNotBlank(rowStyle.getBgcolor())){
		bgcolor=rowStyle.getBgcolor();
	}
	if(colStyle!=null && StringUtils.isNotBlank(colStyle.getBgcolor())){
		bgcolor=colStyle.getBgcolor();
	}
	if(StringUtils.isNotEmpty(bgcolor)){
		String[] colors=bgcolor.split(",");
		cell.setBackgroundColor(new BaseColor(Integer.valueOf(colors[0]),Integer.valueOf(colors[1]),Integer.valueOf(colors[2])));
	}
	return cell;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:72,代码来源:PdfProducer.java

示例15: buildPdfDocument

import com.itextpdf.text.pdf.PdfPCell; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void buildPdfDocument(Map<String, Object> model, Document doc,
        PdfWriter writer, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    // get data model which is passed by the Spring container
    List<HrmsLogin> users = (List<HrmsLogin>) model.get("allUsers");
     
    doc.add(new Paragraph("Master List of Users"));
     
    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100.0f);
    table.setWidths(new float[] {3.0f, 2.0f, 2.0f, 2.0f});
    table.setSpacingBefore(10);
     
    // define font for table header row
    Font font = FontFactory.getFont(FontFactory.HELVETICA);
    font.setColor(BaseColor.WHITE);
     
    // define table header cell
    PdfPCell cell = new PdfPCell();
    cell.setBackgroundColor(BaseColor.BLUE);
    cell.setPadding(5);
     
    // write table header
    cell.setPhrase(new Phrase("Employee ID", font));
    table.addCell(cell);
     
    cell.setPhrase(new Phrase("Username", font));
    table.addCell(cell);
	 
    cell.setPhrase(new Phrase("Password", font));
    table.addCell(cell);
     
    cell.setPhrase(new Phrase("Role", font));
    table.addCell(cell);
     
   
     
    // write table row data
    for (HrmsLogin user : users) {
        table.addCell(user.getHrmsEmployeeDetails().getEmpId()+"");
        table.addCell(user.getUsername());
        table.addCell(user.getPassword());
        table.addCell(user.getRole());
        
    }
     
    doc.add(table);
     
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:52,代码来源:HRPDFBuilderImpl.java


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