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


Java FontFamily.HELVETICA属性代码示例

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


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

示例1: addBalancedReportTitle

/**
 * Adds the report title for balanced report.
 *
 * @param document
 *         the report document.
 * @param reportName
 *         the report name.
 * @param fiscalYear
 *         the fiscal year.
 * @param quarter
 *         the quarter.
 * @param startDate
 *         the start date.
 * @param endDate
 *         the end date.
 * @throws com.itextpdf.text.DocumentException
 *         if any error occurs.
 */
static void addBalancedReportTitle(com.itextpdf.text.Document document, String reportName, Integer fiscalYear,
                                   Integer quarter, Date startDate, Date endDate)
        throws com.itextpdf.text.DocumentException {
    com.itextpdf.text.Paragraph title = new com.itextpdf.text.Paragraph(reportName,
            new Font(FontFamily.HELVETICA, 16, Font.BOLD));
    title.setAlignment(PDF_ALIGN_CENTER);
    document.add(title);
    if (fiscalYear != null && quarter != null) {
        com.itextpdf.text.Paragraph subTitle1 = new com.itextpdf.text.Paragraph("Fiscal Year " + fiscalYear +
                " - Quarter" + quarter, new Font(FontFamily.HELVETICA, 14, Font.BOLD));
        subTitle1.setAlignment(PDF_ALIGN_CENTER);
        document.add(subTitle1);
    }
    if (startDate != null && endDate != null) {
        com.itextpdf.text.Paragraph subTitle2 = new com.itextpdf.text.Paragraph("Processed between " +
                "" + REPORT_DATE_FORMAT.format(startDate) + " and " +
                "" + REPORT_DATE_FORMAT.format(endDate),
                new Font(FontFamily.HELVETICA, 12, Font.BOLD));
        subTitle2.setAlignment(PDF_ALIGN_CENTER);
        document.add(subTitle2);
    }
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:40,代码来源:ReportServiceHelper.java

示例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();
	}
 
开发者ID:kohmiho,项目名称:iTextTutorial,代码行数:20,代码来源:T11_ColumnText.java

示例3: createHeaderBlock

public static void createHeaderBlock(PdfContentByte cb, int pageNumber, int pageSize) throws DocumentException, IOException {
    cb.saveState();
    cb.setColorFill(BaseColor.BLACK);
    cb.rectangle(0.0f, 822.0f, 595.0f, 20.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Font textFont = new Font(FontFamily.HELVETICA, 7, Font.NORMAL, BaseColor.WHITE);

    PdfPTable table = new PdfPTable(4);
    float[] rows = { 100f, 100f, 100f, 295f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.getDefaultCell().setFixedHeight(20);
    table.addCell(new Phrase(new Chunk("WALD 1.1 gGmbH", textFont)));
    table.addCell(new Phrase(new Chunk("[ Spendenkonto 222 888 ]", textFont)));
    table.addCell(new Phrase(new Chunk("www.iplantatree.org", textFont)));
    
    PdfPCell pageCell = new PdfPCell(new Phrase(new Chunk("Seite " + pageNumber + " von " + pageSize, textFont)));
    pageCell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
    pageCell.setBorder(PdfPCell.NO_BORDER);
    table.addCell(pageCell);
    table.writeSelectedRows(0, 1, 0, 842, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:27,代码来源:PdfHelper.java

示例4: createAdress

public static void createAdress(PdfContentByte cb, float xCoord, float yCoord) throws DocumentException {
    Font textFontForAdress = new Font(FontFamily.HELVETICA, 10, Font.NORMAL, BaseColor.BLACK);

    PdfPTable table = new PdfPTable(1);
    float[] rows = { 200f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setFixedHeight(14f);

    table.addCell(new Phrase(new Chunk("Wald 1.1 gemeinnützige GmbH", textFontForAdress)));
    table.addCell(new Phrase(new Chunk("Gabelsbergerstraße 4", textFontForAdress)));
    table.addCell(new Phrase(new Chunk("D-06114 Halle", textFontForAdress)));

    table.writeSelectedRows(0, 3, xCoord, yCoord, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:15,代码来源:PdfHelper.java

示例5: main

public static void main(String[] args) throws Exception{
	FileOutputStream out = new FileOutputStream("demo.pdf");
	//Rectangle rectangle = new Rectangle(216f, 720f);
	//Document document = new Document(rectangle, 36f, 72f, 108f, 180f);
	Document document = new Document(PageSize.A4);
	
	//document.setPageSize(PageSize.B5);
	//document.setMarginMirroring(true);
	//document.setMarginMirroringTopBottom(true);
	
	//BaseFont msyh = BaseFont.createFont("src/main/resources/com/hg/ecommerce/util/SIMSUNB.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
	BaseFont msyh = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
	
	PdfWriter writer = PdfWriter.getInstance(document, out);
	writer.setCloseStream(false);
	//writer.setUserunit(100f);
	
	document.open();
	
	document.add(new Paragraph("Hello World!"));
	
	document.add(new Chunk("中国",new Font(msyh,12,Font.BOLD)));
	document.add(new Chunk(" "));
	
	Font font = new Font(FontFamily.HELVETICA, 6, Font.BOLD, BaseColor.WHITE);
	Chunk chunk = new Chunk("+86",font);
	chunk.setBackground(BaseColor.BLACK, 1f, 0.5f, 1f, 1.5f);
	chunk.setTextRise(6f);
	
	document.add(chunk);
	document.add(Chunk.NEWLINE);
	
	
	document.close();
	out.close();
}
 
开发者ID:doomdagger,项目名称:s_framework,代码行数:36,代码来源:PdfPrinter.java

示例6: addReportTitle

/**
 * Adds a title paragraph to the PDF document.
 *
 * @param document
 *         the document.
 * @param title
 *         the title text.
 * @throws com.itextpdf.text.DocumentException
 *         if any error occurs.
 */
static void addReportTitle(com.itextpdf.text.Document document, String title)
        throws com.itextpdf.text.DocumentException {
    if (Helper.isNullOrEmpty(title)) {
        return;
    }
    com.itextpdf.text.Paragraph p = new com.itextpdf.text.Paragraph(title,
            new Font(FontFamily.HELVETICA, 16, Font.BOLD));
    p.setAlignment(PDF_ALIGN_CENTER);
    document.add(p);
}
 
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:20,代码来源:ReportServiceHelper.java

示例7: buildPdfDocument

protected void buildPdfDocument(        
		Map<String, Object> model,        
		Document document,        
		PdfWriter writer,        
		HttpServletRequest req,        
		HttpServletResponse resp)        
				throws Exception {
	
	
	// Get data "articles" from model
	@SuppressWarnings("unchecked")
	List<HrmsLogin> users = (List<HrmsLogin>) model.get("allUsers");
	
	// Fonts
	Font fontTitle = new Font(FontFamily.TIMES_ROMAN, 14, Font.BOLD, BaseColor.BLACK);
	Font fontTag = new Font(FontFamily.HELVETICA, 10, Font.BOLD, BaseColor.WHITE);

	for(HrmsLogin user: users){

		// 1.Title
		document.add(new Chunk("Employee ID: "));
		Chunk title = new Chunk(user.getHrmsEmployeeDetails().getEmpId()+"", fontTitle);
		document.add(title);
		document.add(new Chunk(" "));

		// -- newline
		document.add(Chunk.NEWLINE);

		// 2.URL
		document.add(new Chunk("Username: "));
		Chunk title2 = new Chunk(user.getUsername(), fontTitle);
		document.add(title2);
		document.add(new Chunk(" "));
		
		// -- newline
		document.add(Chunk.NEWLINE);

		// 3.Categories
		document.add(new Chunk("Password: "));
		Chunk title3 = new Chunk(user.getPassword(), fontTitle);
		document.add(title3);
		document.add(new Chunk(" "));
		
		// -- newline
		document.add(Chunk.NEWLINE);
		
		// 4.Tags
		document.add(new Chunk("Employee ID: "));
		Chunk title4 = new Chunk(user.getRole(), fontTitle);
		document.add(title4);
		document.add(new Chunk(" "));
		
		// -- newline
		document.add(Chunk.NEWLINE);
		document.add(Chunk.NEWLINE);

	}
	

}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:60,代码来源:PDFView.java

示例8: getFooterTable

public static PdfPTable getFooterTable(int x, int y)
{
    java.util.Date date = new java.util.Date();

    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy");

    String month = sdf.format(date);
    System.out.println("Month : " + month);

    PdfPTable table = new PdfPTable(1);

    table.setTotalWidth(120);
    table.setLockedWidth(true);

    table.getDefaultCell().setFixedHeight(20);
    table.getDefaultCell().setBorder(Rectangle.TOP);
    table.getDefaultCell().setBorder(Rectangle.LEFT);
    table.getDefaultCell().setBorder(Rectangle.RIGHT);
    table.getDefaultCell().setBorderColorTop(BaseColor.BLUE);
    table.getDefaultCell().setBorderColorLeft(BaseColor.BLUE);
    table.getDefaultCell().setBorderColorRight(BaseColor.BLUE);
    table.getDefaultCell().setBorderWidthTop(1f);
    table.getDefaultCell().setBorderWidthLeft(1f);
    table.getDefaultCell().setBorderWidthRight(1f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    Font font1 = new Font(FontFamily.HELVETICA, 10, Font.BOLD, BaseColor.BLUE);

    table.addCell(new Phrase("CONTROLLED COPY", font1));

    table.getDefaultCell().setFixedHeight(20);
    table.getDefaultCell().setBorder(Rectangle.LEFT);
    table.getDefaultCell().setBorder(Rectangle.RIGHT);
    table.getDefaultCell().setBorderColorLeft(BaseColor.BLUE);
    table.getDefaultCell().setBorderColorRight(BaseColor.BLUE);
    table.getDefaultCell().setBorderWidthLeft(1f);
    table.getDefaultCell().setBorderWidthRight(1f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    Font font = new Font(FontFamily.HELVETICA, 10, Font.BOLD, BaseColor.RED);

    table.addCell(new Phrase(month, font));

    table.getDefaultCell().setFixedHeight(20);
    table.getDefaultCell().setBorder(Rectangle.LEFT);
    table.getDefaultCell().setBorder(Rectangle.RIGHT);
    table.getDefaultCell().setBorder(Rectangle.BOTTOM);
    table.getDefaultCell().setBorderColorLeft(BaseColor.BLUE);
    table.getDefaultCell().setBorderColorRight(BaseColor.BLUE);
    table.getDefaultCell().setBorderColorBottom(BaseColor.BLUE);
    table.getDefaultCell().setBorderWidthLeft(1f);
    table.getDefaultCell().setBorderWidthRight(1f);
    table.getDefaultCell().setBorderWidthBottom(1f);

    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);

    table.addCell(new Phrase("BLR DESIGN DEPT.", font1));

    return table;
}
 
开发者ID:mkl-public,项目名称:testarea-itext5,代码行数:62,代码来源:FindFreeSpace.java

示例9: createBlueBlock

private void createBlueBlock(PdfContentByte cb, int treeCount) throws DocumentException {
    cb.saveState();
    cb.setRGBColorFill(0x64, 0xA7, 0xBD);
    cb.rectangle(0.0f, 375.0f, 595.0f, 200.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Font textFont = new Font(FontFamily.TIMES_ROMAN, 14, Font.ITALIC, BaseColor.WHITE);
    Font textBlack = new Font(FontFamily.TIMES_ROMAN, 14, Font.ITALIC, BaseColor.BLACK);
    Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
    PdfPTable tableForTreeCount = new PdfPTable(1);
    float[] rows = { 495f };
    tableForTreeCount.setTotalWidth(rows);
    tableForTreeCount.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    tableForTreeCount.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    tableForTreeCount.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    tableForTreeCount.getDefaultCell().setFixedHeight(40);

    Integer treeCountAsObject = treeCount;
    tableForTreeCount.addCell(new Phrase(new Chunk(treeCountAsObject.toString(), textFontTreeCount)));

    tableForTreeCount.writeSelectedRows(0, 1, 50f, 575f, cb);

    PdfPTable tableForWhiteText = new PdfPTable(1);
    tableForWhiteText.setTotalWidth(rows);
    tableForWhiteText.getDefaultCell().setBorder(Rectangle.BOTTOM);
    tableForWhiteText.getDefaultCell().setBorderWidth(1f);
    tableForWhiteText.getDefaultCell().setBorderColor(BaseColor.WHITE);
    tableForWhiteText.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    tableForWhiteText.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    tableForWhiteText.getDefaultCell().setFixedHeight(40);

    Phrase phraseForTreesPlantForYou = new Phrase();
    if (treeCount == 1) {
        phraseForTreesPlantForYou.add(new Chunk("Baum wurde für Sie gepflanzt!", textFont));
    } else {
        phraseForTreesPlantForYou.add(new Chunk("Bäume wurden für Sie gepflanzt!", textFont));
    }

    PdfPCell longTextCell = new PdfPCell();
    longTextCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    longTextCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    longTextCell.setBorder(Rectangle.BOTTOM);
    longTextCell.setBorderWidth(1f);
    longTextCell.setBorderColor(BaseColor.WHITE);
    longTextCell.setFixedHeight(65);

    Paragraph longText = new Paragraph(new Chunk(
            "Mit diesem Gutschein können sie Ihre Pflanzung in Augenschein nehmen und mehr über die naturnahen Aufforstungsprojekte bei \"I Plant A Tree\" erfahren. Ihre Bäume wachsen auf ehemals brachliegenden Flächen und sind Teil neu entstehender Wälder.",
            textFont));
    longText.setLeading(15f);

    longTextCell.addElement(longText);

    tableForWhiteText.addCell(phraseForTreesPlantForYou);
    tableForWhiteText.addCell(longTextCell);
    tableForWhiteText.writeSelectedRows(0, 2, 50f, 535f, cb);

    PdfPTable tableForHowItWorks = new PdfPTable(1);
    tableForHowItWorks.setTotalWidth(rows);
    tableForHowItWorks.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    tableForHowItWorks.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    tableForHowItWorks.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    tableForHowItWorks.getDefaultCell().setFixedHeight(40);

    tableForHowItWorks.addCell(new Phrase(new Chunk("Und so einfach funktioniert's:", textBlack)));

    tableForHowItWorks.writeSelectedRows(0, 2, 50f, 425f, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:70,代码来源:PdfGiftView.java

示例10: createTreeCountAndCustomTextBlock

private void createTreeCountAndCustomTextBlock(PdfContentByte cb, String customText, int treeCount) throws DocumentException {
    Font textFont = new Font(FontFamily.TIMES_ROMAN, 16, Font.ITALIC, BaseColor.BLACK);
    Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
    Font customTextFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.BLACK);

    cb.saveState();
    cb.setRGBColorFill(0xE0, 0xDE, 0xDF);
    cb.rectangle(0.0f, 325.0f, 595.0f, 205.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Integer treeCountAsObj = treeCount;

    PdfPTable table = new PdfPTable(1);
    float[] rows = { 595f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.getDefaultCell().setFixedHeight(35);
    table.addCell(new Phrase(new Chunk("über die Pflanzung von", textFont)));
    table.addCell(new Phrase(new Chunk(treeCountAsObj.toString(), textFontTreeCount)));
    table.addCell(new Phrase(new Chunk("Bäumen", textFont)));
    table.writeSelectedRows(0, 3, 0, 520, cb);

    cb.saveState();
    cb.setRGBColorFill(0xF7, 0xF2, 0xF4);
    cb.rectangle(50.0f, 345.0f, 495.0f, 60.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    PdfPTable textTable = new PdfPTable(1);
    float[] textRows = { 475f };
    textTable.setTotalWidth(textRows);
    textTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    textTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    textTable.getDefaultCell().setFixedHeight(40);
    textTable.addCell(new Phrase(new Chunk(customText, customTextFont)));
    textTable.writeSelectedRows(0, 1, 60, 395, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:42,代码来源:PdfCertificateView.java

示例11: createLawTextDateAndSignatureBlock

private void createLawTextDateAndSignatureBlock(PdfContentByte cb, String number, String date) throws DocumentException, MalformedURLException, IOException {
    Font textFont = new Font(FontFamily.HELVETICA, 10, Font.NORMAL, BaseColor.BLACK);
    Font textFontBold = new Font(FontFamily.HELVETICA, 10, Font.BOLD, BaseColor.BLACK);
    Font textFontSmall = new Font(FontFamily.HELVETICA, 6, Font.NORMAL, BaseColor.BLACK);

    PdfPTable table = new PdfPTable(2);
    float[] rows = { 247.5f, 247.5f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.BOTTOM);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);

    table.getDefaultCell().setFixedHeight(75);

    Phrase leftPhrase = new Phrase();
    leftPhrase.add(new Chunk(
            "Hiermit wird die Pflanzung dieser Bäume bescheinigt. Die Pflanzung erfolgt durch die Wald 1.1 gGmbH und kann im Internet unter www.iplantatree.org über die Zertifikat-Nummer #",
            textFont));
    leftPhrase.add(new Chunk(number, textFontBold));
    leftPhrase.add(new Chunk(" abgerufen bzw. nachvollzogen werden.", textFont));

    Phrase rightPhrase = new Phrase(10f);
    rightPhrase.add(new Chunk(
            "Dieses Zertifikat ist keine Bestätigung über Geldzuwendungen im Sinne des § 10 b des Einkommensteuergesetzes an eine der in § 5 Abs. 1 Nr. 9 des Körperschaftsteuergesetzes bezeichneten Körperschaften, Personenvereinigungen oder Vermögensmassen.",
            textFont));

    PdfPCell rightCell = new PdfPCell();
    rightCell.setPaddingLeft(10.0f);
    rightCell.setBorder(Rectangle.BOTTOM);
    rightCell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    rightCell.setVerticalAlignment(Element.ALIGN_TOP);
    rightCell.addElement(rightPhrase);

    PdfPCell dateCell = new PdfPCell();
    dateCell.setPaddingTop(10.0f);
    dateCell.setBorder(Rectangle.NO_BORDER);
    dateCell.addElement(new Phrase(new Chunk("Datum der Ausstellung: " + date, textFont)));

    PdfPCell emptyCell = new PdfPCell();
    emptyCell.setBorder(Rectangle.NO_BORDER);

    final Image signatureImage = Image.getInstance(getClass().getResource(_imagePath + "/Unterschrift150.jpg"));

    PdfPCell underSignatureCell = new PdfPCell();
    underSignatureCell.setBorder(Rectangle.NO_BORDER);
    underSignatureCell.setPadding(0f);

    Phrase underSignaturePhrase = new Phrase(10f);
    underSignaturePhrase.add(new Chunk("Unterschrift / Stempel des ausstellenden Unternehmens / der ausstellenden Person", textFontSmall));

    underSignatureCell.addElement(underSignaturePhrase);
    underSignatureCell.setVerticalAlignment(Element.ALIGN_TOP);

    table.addCell(leftPhrase);
    table.addCell(rightCell);

    table.addCell(dateCell);
    table.addCell(emptyCell);

    table.addCell(signatureImage);
    table.addCell(emptyCell);

    table.addCell(underSignatureCell);
    table.addCell(emptyCell);

    table.writeSelectedRows(0, 4, 50, 305, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:67,代码来源:PdfCertificateView.java

示例12: createTreeCountAndCustomTextBlock

private void createTreeCountAndCustomTextBlock(PdfContentByte cb, String customText, int treeCount) throws DocumentException {
    Font textFont = new Font(FontFamily.TIMES_ROMAN, 16, Font.ITALIC, BaseColor.WHITE);
    Font textFontTreeCount = new Font(FontFamily.HELVETICA, 30, Font.BOLD, BaseColor.BLACK);
    Font customTextFont = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, BaseColor.BLACK);

    cb.saveState();
    cb.setRGBColorFill(0x64, 0xA7, 0xBD);
    cb.rectangle(0.0f, 325.0f, 595.0f, 205.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    Integer treeCountAsObj = treeCount;

    PdfPTable table = new PdfPTable(1);
    float[] rows = { 595f };
    table.setTotalWidth(rows);
    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.getDefaultCell().setFixedHeight(35);
    table.addCell(new Phrase(new Chunk("über die Pflanzung von", textFont)));
    table.addCell(new Phrase(new Chunk(treeCountAsObj.toString(), textFontTreeCount)));
    table.addCell(new Phrase(new Chunk("Bäumen", textFont)));
    table.writeSelectedRows(0, 3, 0, 520, cb);

    cb.saveState();
    cb.setRGBColorFill(0xF7, 0xF2, 0xF4);
    cb.rectangle(50.0f, 345.0f, 495.0f, 60.0f);
    cb.fill();
    cb.stroke();
    cb.restoreState();

    PdfPTable textTable = new PdfPTable(1);
    float[] textRows = { 475f };
    textTable.setTotalWidth(textRows);
    textTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    textTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    textTable.getDefaultCell().setFixedHeight(40);
    textTable.addCell(new Phrase(new Chunk(customText, customTextFont)));
    textTable.writeSelectedRows(0, 1, 60, 395, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:42,代码来源:PdfCertificateView2.java


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