本文整理汇总了Java中com.itextpdf.text.Paragraph.add方法的典型用法代码示例。如果您正苦于以下问题:Java Paragraph.add方法的具体用法?Java Paragraph.add怎么用?Java Paragraph.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.itextpdf.text.Paragraph
的用法示例。
在下文中一共展示了Paragraph.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObjectDescription
import com.itextpdf.text.Paragraph; //导入方法依赖的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;
}
示例2: addTitlePage
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private static void addTitlePage(Document document,Resolucion res)
throws DocumentException {
Paragraph preface = new Paragraph();
// We add one empty line
addEmptyLine(preface, 1);
// Lets write a big header
preface.add(new Paragraph("Consejo Profesional de Informatica de Santiago del Estero", catFont));
addEmptyLine(preface, 1);
// Will create: Report generated by: _name, _date
preface.add(new Paragraph( "Comision Directiva del Consejo, " + new Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
smallBold));
addEmptyLine(preface, 2);
preface.add(new Paragraph("Resolucion N°"+res.getNumero_resolucion()+"",
smallBold));
addEmptyLine(preface, 3);
preface.add(new Paragraph("Esta Resolucion de tipo "+res.getTipo()+" formulada para notificar al socio con legajo: "+res.getLegajo_socio()+" de su actual estado como socio del Consejo.\n"
+ res.getDescripcion_solicitud()+" "+res.getDescripcion_resolucion()+" en la fecha "+res.getFecha(),
cuerpo));
document.add(preface);
// Start a new page
document.newPage();
}
示例3: getComments
import com.itextpdf.text.Paragraph; //导入方法依赖的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);
}
示例4: createSimpleTextPdf
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
static byte[] createSimpleTextPdf(String paragraphFormat, int paragraphCount) throws DocumentException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document document = new Document();
PdfWriter.getInstance(document, baos);
document.open();
for (int i = 0; i < paragraphCount; i++)
{
Paragraph paragraph = new Paragraph();
paragraph.add(String.format(paragraphFormat, i));
document.add(paragraph);
}
document.close();
return baos.toByteArray();
}
示例5: createSimpleTextPdf
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
/**
* This method creates a PDF with a single styled paragraph.
*/
static byte[] createSimpleTextPdf() throws DocumentException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document document = new Document();
PdfWriter.getInstance(document, baos);
document.open();
Paragraph paragraph = new Paragraph();
paragraph.add(new Phrase("Beware: ", new Font(FontFamily.HELVETICA, 12, Font.BOLDITALIC)));
paragraph.add(new Phrase("The implementation of ", new Font(FontFamily.HELVETICA, 12, Font.ITALIC)));
paragraph.add(new Phrase("MarginFinder", new Font(FontFamily.COURIER, 12, Font.ITALIC)));
paragraph.add(new Phrase(" is far from optimal. It is not even correct as it includes all curve control points which is too much. Furthermore it ignores stuff like line width or wedge types. It actually merely is a proof-of-concept.", new Font(FontFamily.HELVETICA, 12, Font.ITALIC)));
document.add(paragraph);
document.close();
return baos.toByteArray();
}
示例6: createSimpleTextPdf
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
static byte[] createSimpleTextPdf() throws DocumentException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document document = new Document();
PdfWriter.getInstance(document, baos);
document.open();
for (int i = 1; i < 20; i++)
{
Paragraph paragraph = new Paragraph();
for (int j = 0; j < i; j++)
paragraph.add("Hello World! ");
document.add(paragraph);
}
document.close();
return baos.toByteArray();
}
示例7: getTitlePDF
import com.itextpdf.text.Paragraph; //导入方法依赖的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;
}
示例8: getSeriesComments
import com.itextpdf.text.Paragraph; //导入方法依赖的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;
}
}
示例9: getElementAndSampleInfo
import com.itextpdf.text.Paragraph; //导入方法依赖的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;
}
示例10: getTimestampPDF
import com.itextpdf.text.Paragraph; //导入方法依赖的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;
}
示例11: getObjectComments
import com.itextpdf.text.Paragraph; //导入方法依赖的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;
}
示例12: addContent
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private void addContent(PdfWriter writer) throws DocumentException, PdfFormatierungsException {
Anchor anchor = new Anchor("Lernentwicklungsbericht", lernentwicklungsberichtUeberschriftFont);
Chapter chapterLEB = new Chapter(new Paragraph(anchor), 1);
chapterLEB.setNumberDepth(0);
Paragraph paragraphHeader = new Paragraph();
paragraphHeader.setLeading(FIXED_LEADING_TEXT, 1);
sectionCount += 1;
Section headerSection = chapterLEB.addSection(paragraphHeader);
headerSection.setNumberDepth(0);
paragraphHeader.add(Chunk.NEWLINE);
paragraphHeader.add(PdfFormatHelper.buildHeaderNameLine(lebData.getSchuelername() , headerFont));
paragraphHeader.add(Chunk.NEWLINE);
paragraphHeader.add(PdfFormatHelper.buildHeaderKlassendatenLine(lebData, headerFont));
headerSection.add(Chunk.NEWLINE);
headerSection.add(Chunk.NEWLINE);
document.add(chapterLEB);
insertDummyLineIfNecessary(writer);
addKlassenbrief(chapterLEB, writer);
addIndividuelleEinschaetzung(chapterLEB, writer);
addFacheinschaetzungen(chapterLEB, writer);
}
示例13: addKlassenbrief
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private void addKlassenbrief(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException {
if (!lebData.getKlassenbrief().isEmpty()) {
sectionCount += 1;
breakSchusterjunge(writer);
Paragraph paragraphKlassenbrief = new Paragraph();
Section klassenbriefSection = chapterLEB.addSection(paragraphKlassenbrief);
klassenbriefSection.setNumberDepth(0);
Paragraph klasseneinschaetzungParapgraph = new Paragraph(lebData.getKlassenbrief().replace('\t', '\0'), standardTextFont);
klasseneinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
klasseneinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
klasseneinschaetzungParapgraph.add(Chunk.NEWLINE);
if (lebData.getIndividuelleEinschaetzung().isEmpty()) {
klassenbriefSection.add(klasseneinschaetzungParapgraph);
document.add(klassenbriefSection);
document.add(getKlassenlehrerunterschrift(chapterLEB));
} else {
klasseneinschaetzungParapgraph.add(Chunk.NEWLINE);
klassenbriefSection.add(klasseneinschaetzungParapgraph);
document.add(klassenbriefSection);
}
alertLonelyHeader(writer);
insertDummyLineIfNecessary(writer);
}
}
示例14: schreibeSchueler
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private static void schreibeSchueler(Schueler sch, Document pdf)
throws IOException, DocumentException {
log.fine("Schueler daten schreiben");
Paragraph schueler = new Paragraph();
schueler.add(new Paragraph("Benutzername:" + sch.getKurzname(),
benutzerFont));
schueler.add(new Paragraph("Kennwort:" + sch.getPasswort(),
passwortFont));
addEmptyLine(schueler, 1);
schueler.add(new Paragraph("Ihre pers�nlichen Daten zur �berpr�fung:",
textBold));
schueler.add(new Paragraph(sch.getVorname() + " "
+ sch.getFamilienname(), textFont));
schueler.add(new Paragraph(sch.getPLZ() + " " + sch.getStadt(),
textFont));
schueler.add(new Paragraph(sch.getStrasse(), textFont));
schueler.add(new Paragraph("Geburtsdatum:"
+ schreibeCalendar(sch.getGeburtsdatum()), textFont));
schueler.add(new Paragraph("Klasse:" + sch.getKlasse(), textFont));
pdf.add(schueler);
}
示例15: process
import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
List<Element> subs = context.collectChildren(level, node);
Paragraph p = new Paragraph();
for (Element sub : subs) {
p.add(discardNewline(sub));
}
KeyValues kvs = context.iTextContext().keyValues();
Float spacingBefore = kvs.<Float>getNullable(PARAGRAPH_SPACING_BEFORE).or(5f);
Float spacingAfter = kvs.<Float>getNullable(PARAGRAPH_SPACING_AFTER).or(5f);
p.setSpacingBefore(spacingBefore);
p.setSpacingAfter(spacingAfter);
applyAttributes(context, p);
context.append(p);
}