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


Java Chunk类代码示例

本文整理汇总了Java中com.itextpdf.text.Chunk的典型用法代码示例。如果您正苦于以下问题:Java Chunk类的具体用法?Java Chunk怎么用?Java Chunk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getObjectDescription

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private Paragraph getObjectDescription() 
{

	Paragraph p = new Paragraph();
	p.setLeading(0, 1.2f);
	p.setAlignment(Element.ALIGN_JUSTIFIED);
       p.setSpacingAfter(10);
       p.setSpacingBefore(50);
       
	if(o.getDescription()!=null){
		p.add(new Chunk(o.getDescription(), bodyFont));
	}
	else{
		p.add(new Chunk("No description recorded", bodyFont));
	}
	
	return p;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:19,代码来源:ProSheet.java

示例2: createLawTable

import com.itextpdf.text.Chunk; //导入依赖的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;
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:23,代码来源:PdfReceiptView.java

示例3: buildComponent

import com.itextpdf.text.Chunk; //导入依赖的package包/类
@Override
public void buildComponent(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EvaluatedHtmlPresentationNode pEvalNode) {
  Map<String, StringAttributeResult> lNodeAttributes = pEvalNode.getAttributeMap(false);
  String lSourceURI = Optional.ofNullable(lNodeAttributes.get(IMAGE_SOURCE_ATTRIBUTE))
                              .map(StringAttributeResult::getString)
                              .flatMap(Optional::ofNullable)
                              .orElseThrow(() -> new ExInternal("Could not find '" + IMAGE_SOURCE_ATTRIBUTE + "' attribute on HTML image"));
  Image lImage = getImage(pSerialisationContext, lSourceURI);

  // Set the image dimensions if specified in the node attributes, using the current element attributes if dimensions
  // are specified in relative units e.g. ems
  setImageDimensions(lImage, lNodeAttributes, pSerialiser.getElementAttributes());

  // Add the image within a chunk so it appears inline and changes the line leading to fit the image
  pSerialiser.add(new Chunk(lImage, IMAGE_X_OFFSET, IMAGE_Y_OFFSET, true));
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:17,代码来源:ImageComponentBuilder.java

示例4: testAnnotationIconForTYD

import com.itextpdf.text.Chunk; //导入依赖的package包/类
/**
 * <a href="https://stackoverflow.com/questions/46204693/cant-get-itext-rectangle-to-work-correctly-with-annotations">
 * Can't get itext Rectangle to work correctly with annotations
 * </a>
 * <p>
 * This test looks at a <b>Text</b> annotation added via a {@link Chunk}
 * as done by the OP. As this way of adding annotations resets the
 * annotation <b>Rect</b> to the bounding box of the rendered {@link Chunk},
 * it is not really what the OP wants.
 * </p>
 */
@Test
public void testAnnotationIconForTYD() throws FileNotFoundException, DocumentException {
    Document document = new Document();
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(new File(RESULT_FOLDER, "annotationIcons.pdf")));
    document.open();

    // Not "new Rectangle(164, 190, 164, 110)" which would be empty
    Rectangle rect = new Rectangle(164, 190, 328, 300);

    // Annotation added like the OP does
    Chunk chunk_text = new Chunk("Let's test a Text annotation...");
    chunk_text.setAnnotation(PdfAnnotation.createText(writer, rect, "Warning", "This is a Text annotation with Comment icon.", false, "Comment"));        

    document.add(chunk_text);

    // Annotation added to the document without Chunk
    writer.addAnnotation(PdfAnnotation.createText(writer, rect, "Warning 2", "This is another Text annotation with Comment icon.", false, "Comment"));

    document.close();
}
 
开发者ID:mkl-public,项目名称:testarea-itext5,代码行数:32,代码来源:AnnotationIcons.java

示例5: getTitlePDF

import com.itextpdf.text.Chunk; //导入依赖的package包/类
/**
 * Get an iText Paragraph for the Title 
 * 
 * @return Paragraph
 */
private Paragraph getTitlePDF()
{
	Paragraph p = new Paragraph();
	
	p.add(new Chunk(s.getDisplayTitle()+"\n", titleFont));

	// Add object name if this is a mSeries
	if(s.getSeries() instanceof TridasMeasurementSeries)
	{
		TridasObject tobj = s.getMeta(Metadata.OBJECT, TridasObject.class);
	
		p.add(new Chunk(tobj.getTitle(), subTitleFont));
	}		
	return p;		
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:21,代码来源:SeriesReport.java

示例6: getTimestampPDF

import com.itextpdf.text.Chunk; //导入依赖的package包/类
/**
 * iText paragraph containing created and lastmodified timestamps
 * 
 * @return Paragraph
 */
private Paragraph getTimestampPDF()
{
	// Set up calendar
	Date createdTimestamp = s.getSeries().getCreatedTimestamp().getValue()
			.toGregorianCalendar().getTime();
	Date lastModifiedTimestamp = s.getSeries().getLastModifiedTimestamp()
			.getValue().toGregorianCalendar().getTime();
	DateFormat df1 = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT);
	
	Paragraph p = new Paragraph();


	p.add(new Chunk("Created: ", subSubSectionFont));
	p.add(new Chunk(df1.format(createdTimestamp), bodyFont));
	p.add(new Chunk("\nLast Modified: ", subSubSectionFont));
	p.add(new Chunk(df1.format(lastModifiedTimestamp), bodyFont));

	
	return p;
	
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:27,代码来源:SeriesReport.java

示例7: getSeriesComments

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private Paragraph getSeriesComments() 
{


	Paragraph p = new Paragraph();
	
	if(s.getSeries().getComments()!=null){
		
		p.setLeading(0, 1.2f);
		p.add(new Chunk("Comments: \n", subSubSectionFont));
		p.add(new Chunk(s.getSeries().getComments(), bodyFont));
		return p;
	}
	else
	{
		return p;
	}
	
	
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:21,代码来源:SeriesReport.java

示例8: certaintyToNaturalString

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private Chunk certaintyToNaturalString(String certainty)
{
	Chunk c = new Chunk();
	
	if(certainty.equalsIgnoreCase("exact")){
		c.append("in exactly ");
	}
	else if (certainty.equalsIgnoreCase("after")){
		c.append("after ");
	}
	else if (certainty.equalsIgnoreCase("before")){
		c.append("before ");
	}		
	else{
		c.append("in "+certainty.toLowerCase() + " ");
	}
	
	c.setFont(bodyFont);
	return c;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:21,代码来源:SeriesReport.java

示例9: getElementAndSampleInfo

import com.itextpdf.text.Chunk; //导入依赖的package包/类
/**
 * iText paragraph of element and sample info
 * @return Paragraph
 */
private Paragraph getElementAndSampleInfo()
{
	Paragraph p = new Paragraph();
	
	TridasElement telem = s.getMeta(Metadata.ELEMENT, TridasElement.class);
	TridasSample tsamp = s.getMeta(Metadata.SAMPLE, TridasSample.class);
	
	p.add(new Chunk("Element and sample details:\n", subSubSectionFont));
	
	p.add(new Chunk("- Taxon:  ", bodyFont));
	p.add(new Chunk(telem.getTaxon().getNormal()+"\n", bodyFontItalic));
	p.add(new Chunk("- Element type: "+ telem.getType().getNormal()+"\n", bodyFont));
	p.add(new Chunk("- Sample type: "+ tsamp.getType().getNormal()+"\n", bodyFont));
	return p;
	
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:21,代码来源:SeriesReport.java

示例10: getObjectComments

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private Paragraph getObjectComments() 
{

	Paragraph p = new Paragraph();
	p.setLeading(0, 1.2f);
	p.setAlignment(Element.ALIGN_JUSTIFIED);
       p.setSpacingAfter(10);
	
	if(o.getComments()!=null){
		p.add(new Chunk("Notes: ", commentFont));
		p.add(new Chunk(o.getComments(), commentFont));
	}

	
	return p;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:17,代码来源:ProSheet.java

示例11: getTimestampPDF

import com.itextpdf.text.Chunk; //导入依赖的package包/类
/**
 * iText paragraph containing created and lastmodified timestamps
 * 
 * @return Paragraph
 */
private Paragraph getTimestampPDF(WSIBox b)
{
	// Set up calendar
	Date createdTimestamp = b.getCreatedTimestamp().getValue()
			.toGregorianCalendar().getTime();
	Date nowTimestamp = new Date();
	
	DateFormat df1 = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT);
	
	Paragraph p = new Paragraph();


	p.add(new Chunk("Created: ", subSubSectionFont));
	p.add(new Chunk(df1.format(createdTimestamp), bodyFont));
	//p.add(new Chunk("\nLast Modified: ", subSubSectionFont));
	//p.add(new Chunk(df1.format(lastModifiedTimestamp), bodyFontLarge));
	p.add(new Chunk("\nLabel updated: ", subSubSectionFont));
	p.add(new Chunk(df1.format(nowTimestamp), bodyFont));

	
	return p;
	
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:29,代码来源:CompleteBoxLabel.java

示例12: getComments

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private Paragraph getComments(WSIBox b) throws DocumentException
{

	Paragraph p = new Paragraph();
	p.setLeading(0, 1.2f);
	
	p.add(new Chunk("Comments: \n", subSubSectionFont));
	if(b.getComments()!=null){
		p.add(new Chunk(b.getComments(), bodyFont));
	}
	else{
		p.add(new Chunk("No comments recorded", bodyFont));
	}
	
	return(p);
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:17,代码来源:CompleteBoxLabel.java

示例13: getParagraph

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private void getParagraph(PdfPTable table, String introText, String content, float minimumHeight) {
    Chunk titleChunk = getBoldChunk(introText);
    Chunk contentChunk = getContentChunkIfAvailable(content);
    PdfPCell titleCell = new PdfPCell(new Phrase(titleChunk));
    PdfPCell contentCell = new PdfPCell(new Phrase(contentChunk));
    if(minimumHeight > 0) {
        titleCell.setMinimumHeight(minimumHeight);
        contentCell.setMinimumHeight(minimumHeight);
    }
    table.addCell(titleCell);
    table.addCell(contentCell);
}
 
开发者ID:krispena,项目名称:cbsp-reports,代码行数:13,代码来源:TreeReportWriter.java

示例14: createReceiptHeaderAndTextBelow

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private void createReceiptHeaderAndTextBelow(PdfContentByte cb) throws DocumentException {
    PdfPTable headerTable = new PdfPTable(1);
    float[] rows = { 450f };
    headerTable.setTotalWidth(rows);
    headerTable.getDefaultCell()
               .setBorder(Rectangle.NO_BORDER);

    headerTable.addCell(new Phrase(new Chunk("Bestätigung über Geldzuwendungen", textFontForReceiptHeader)));

    headerTable.writeSelectedRows(0, 1, 75f, 625, cb);

    PdfPTable table = new PdfPTable(1);
    table.setTotalWidth(rows);
    table.getDefaultCell()
         .setBorder(Rectangle.NO_BORDER);
    table.getDefaultCell()
         .setLeading(8f, 0);

    table.addCell(new Phrase(new Chunk("im Sinne des §10b des Einkommensteuergesetzes", textFont)));
    table.addCell(new Phrase(new Chunk("an eine der in §5 Abs. 1 Nr. 9 des Körperschaftsteuergesetzes bezeichneten", textFont)));
    table.addCell(new Phrase(new Chunk("Körperschaften, Personenvereinigungen oder Vermögensmassen", textFont)));

    table.writeSelectedRows(0, 3, 75f, 590, cb);
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:25,代码来源:PdfReceiptView.java

示例15: createPriceTable

import com.itextpdf.text.Chunk; //导入依赖的package包/类
private PdfPTable createPriceTable(PdfContentByte cb, Receipt receipt) throws DocumentException {
    PdfPTable tableForPrices = new PdfPTable(1);
    float[] rowForTotalPrice = { 250f };
    tableForPrices.setTotalWidth(rowForTotalPrice);
    tableForPrices.getDefaultCell()
                  .setBorder(Rectangle.NO_BORDER);

    tableForPrices.addCell(new Phrase(new Chunk("Betrag der Zuwendung in Ziffern:", textFont)));
    tableForPrices.addCell(new Phrase(new Chunk(" ", textFont)));
    Double totalPrice = 0.0;
    for (final Cart cart : receipt.getCarts()) {
        tableForPrices.addCell(new Phrase(new Chunk(cart.getTotalPrice()
                                                        .toString()
                + " €", textFontUserData)));
        totalPrice += cart.getTotalPrice()
                          .doubleValue();
    }
    String formattedPrice = priceFormat.format(totalPrice)
                                       .toString();
    tableForPrices.addCell(new Phrase(new Chunk("Gesamt: " + formattedPrice + " €", textFontUserData)));
    return tableForPrices;
}
 
开发者ID:Dica-Developer,项目名称:weplantaforest,代码行数:23,代码来源:PdfReceiptView.java


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