本文整理匯總了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);
}