本文整理了Java中com.lowagie.text.Paragraph.setSpacingAfter()
方法的一些代码示例,展示了Paragraph.setSpacingAfter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Paragraph.setSpacingAfter()
方法的具体详情如下:
包路径:com.lowagie.text.Paragraph
类名称:Paragraph
方法名:setSpacingAfter
[英]Sets the spacing after this paragraph.
[中]设置此段落后的间距。
代码示例来源:origin: javamelody/javamelody
Element createParagraphElement(String paragraphTitle, String iconName)
throws DocumentException, IOException {
final Paragraph paragraph = new Paragraph("", paragraphTitleFont);
paragraph.setSpacingBefore(5);
paragraph.setSpacingAfter(5);
if (iconName != null) {
paragraph.add(new Chunk(getParagraphImage(iconName), 0, -5));
}
final Phrase element = new Phrase(' ' + paragraphTitle, paragraphTitleFont);
element.setLeading(12);
paragraph.add(element);
// chapter pour avoir la liste des signets
final ChapterAutoNumber chapter = new ChapterAutoNumber(paragraph);
// sans numéro de chapitre
chapter.setNumberDepth(0);
chapter.setBookmarkOpen(false);
chapter.setTriggerNewPage(false);
return chapter;
}
代码示例来源:origin: stackoverflow.com
float spaceBetweenLines = 12;
Paragraph p;
for (final String singleLine : document.getSingleLine()) {
p = new Paragraph(spaceBetweenLines, singleLine, font);
if (singleLine.contains("#ACC")) {
p.setSpacingAfter(spaceBetweenLines);
}
if (!singleLine().isEmpty())
document.add(p);
}
代码示例来源:origin: com.github.linkeer8802/api-resolver-core
@Override
public void installCategorys(List<ApiCategory> apiCategorys) throws Exception {
int ch = 1;
for (ApiCategory apiCategory : apiCategorys) {
Paragraph paApiCategory = new Paragraph(chFont.process(apiCategory.getName() + "\n"));
Chapter chapter = new Chapter(paApiCategory, ch++);
Paragraph paragraph = new Paragraph(textFont.process(apiCategory.getDesc()));
paragraph.setSpacingAfter(10f);
paragraph.setIndentationLeft(8f);
chapter.add(paragraph);
categoryChapters.put(chapter, apiCategory);
}
}
代码示例来源:origin: com.github.librepdf/pdf-html
if (value != null) {
try {
p.setSpacingAfter(Float.parseFloat(value));
} catch (Exception e) {
代码示例来源:origin: com.github.linkeer8802/api-resolver-core
private void addSummary(Section section, ApiDoc apiDoc) throws Exception {
Paragraph summary = new Paragraph(itemFont.process("★简要信息"));
summary.setSpacingBefore(6f);
summary.setSpacingAfter(8f);
List<String[]> rowDatas = new ArrayList<String[]>();
rowDatas.add(new String[]{apiDoc.getMapping()});
rowDatas.add(new String[]{apiDoc.getAuthor()});
rowDatas.add(new String[]{apiDoc.getVersion()});
PdfPTable table = DefaultPdfTable.get().create(TBDirection.Vertical, rowDatas.size(),
new String[]{"映射地址", "作者", "版本"}, new int[]{1, 10});
DefaultPdfTable.get().setDataAlignments(new int[]{Element.ALIGN_LEFT});
DefaultPdfTable.get().setRowDatas(rowDatas);
Paragraph wrapperTable = new Paragraph();
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(table);
section.add(summary);
section.add(wrapperTable);
}
代码示例来源:origin: stackoverflow.com
para1.setSpacingAfter(50);
for (int i = 0; i < 10; i++) {
para1.add(new Chunk(content));
代码示例来源:origin: stackoverflow.com
public PdfPCell getCell4() {
PdfPCell cell = new PdfPCell();
Paragraph p1 = new Paragraph("My fantastic data");
p1.setSpacingAfter(20);
cell.addElement(p1);
LineSeparator ls = new LineSeparator();
cell.addElement(ls);
Paragraph p2 = new Paragraph("Other data");
p2.setSpacingBefore(10);
cell.addElement(p2);
return cell;
}
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms
public Object visit(WikiDefineList node, Object data) {
Paragraph p = new Paragraph();
p.setSpacingBefore(5f);
p.setSpacingAfter(5f);
p.setIndentationLeft(5f);
p.add(Chunk.NEWLINE);
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
Object o = node.jjtGetChild(i).jjtAccept(this, data);
if (o != null)
p.add(o);
}
return p;
}
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms
public Object visit(WikiParagraph node, Object data) {
Paragraph p = new Paragraph();
p.setLeading(20f);
p.setFirstLineIndent(defaultFont_.size());
p.setSpacingBefore(paragraphSpacing_);
p.setSpacingAfter(paragraphSpacing_);
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
Object o = node.jjtGetChild(i).jjtAccept(this, data);
if (o != null)
p.add(o);
}
return p;
}
代码示例来源:origin: qcadoo/mes
private void addPalletNumber(final Document document, final String number) throws DocumentException {
LineSeparator lineSeparator = new LineSeparator(1, 100f, ColorUtils.getLineDarkColor(), Element.ALIGN_LEFT, 0);
Paragraph numberParagraph = new Paragraph(new Phrase(number, FontUtils.getDejavuBold70Dark()));
numberParagraph.setAlignment(Element.ALIGN_CENTER);
numberParagraph.setSpacingBefore(70F);
numberParagraph.setSpacingAfter(180F);
document.add(Chunk.NEWLINE);
document.add(numberParagraph);
document.add(lineSeparator);
}
代码示例来源:origin: com.github.linkeer8802/api-resolver-core
private void addParameters(Section section, ApiDoc apiDoc) throws Exception {
Paragraph inputParams = new Paragraph(itemFont.process("★输入参数"));
inputParams.setSpacingBefore(6f);
inputParams.setSpacingAfter(8f);
List<String[]> rowDatas = new ArrayList<String[]>();
for (ParamDoc paramDoc : apiDoc.getParams()) {
String required = paramDoc.getRequired() ? "必须" : "可选";
rowDatas.add(new String[]{paramDoc.getName(), paramDoc.getType(),
required, paramDoc.getExampleValue(), paramDoc.getDefaultValue(), paramDoc.getDesc()});
}
PdfPTable paramTable = DefaultPdfTable.get().create(TBDirection.Horizontal, rowDatas.size()+1,
new String[]{"名称", "类型", "是否必须", "示例值", "默认值", "描述"},
new int[]{15, 10, 10, 15, 10, 40});
DefaultPdfTable.get().setDataAlignments(new int[]{Element.ALIGN_CENTER, Element.ALIGN_CENTER,
Element.ALIGN_CENTER, Element.ALIGN_CENTER, Element.ALIGN_CENTER, Element.ALIGN_LEFT});
DefaultPdfTable.get().setRowDatas(rowDatas);
Paragraph wrapperTable = new Paragraph();
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(paramTable);
section.add(inputParams);
section.add(wrapperTable);
}
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms
public Object visit(WikiExcerpt node, Object data) {
Properties props = PdfUtils.getDefaultfontProperties(defaultFont_);
props.setProperty(ElementTags.STYLE, MarkupTags.CSS_ITALIC);
Paragraph p = new Paragraph(props);
p.setIndentationLeft(20 * node.level);
p.setSpacingAfter(paragraphSpacing_);
p.setSpacingBefore(paragraphSpacing_);
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
// if child is paragraph, not generate <p> tag
if (node.jjtGetChild(i) instanceof WikiParagraph) {
WikiParagraph c = (WikiParagraph) node.jjtGetChild(i);
for (int j = 0; j < c.jjtGetNumChildren(); j++) {
Object o = c.jjtGetChild(j).jjtAccept(this, data);
if (o != null)
p.add(o);
}
} else {
Object o = node.jjtGetChild(i).jjtAccept(this, data);
if (o != null)
p.add(o);
}
}
return p;
}
代码示例来源:origin: com.github.linkeer8802/api-resolver-core
private void addResultExample(Section section, ApiDoc apiDoc) throws Exception {
Paragraph result = new Paragraph(itemFont.process("★返回示例"));
// result.setLeading(6f);
result.setSpacingBefore(6f);
result.setSpacingAfter(8f);
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(95f);
table.setHorizontalAlignment(Element.ALIGN_LEFT);
PdfPCell pdfPCell = table.getDefaultCell();
pdfPCell.setHorizontalAlignment(Element.ALIGN_LEFT);
pdfPCell.setBackgroundColor(Color.LIGHT_GRAY);
if (apiDoc.getResultDoc() != null && apiDoc.getResultExample() != null) {
pdfPCell.setPhrase(DefaultPdfTable.tableBSelector.process(apiDoc.getResultExample()));
}
table.addCell(pdfPCell);
Paragraph wrapperTable = new Paragraph();
wrapperTable.setSpacingAfter(8f);
wrapperTable.setIndentationLeft(12f);
wrapperTable.add(table);
section.add(result);
section.add(wrapperTable);
}
}
代码示例来源:origin: org.seasar.tuigwaa/tuigwaa-cms
public Object visit(WikiExplanationWord node, Object data) {
Paragraph p = new Paragraph();
p.setSpacingAfter(5f);
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
Node child = node.jjtGetChild(i);
if (child instanceof WikiParagraph) {
for (int j = 0; j < child.jjtGetNumChildren(); j++) {
Object o = child.jjtGetChild(j).jjtAccept(this, data);
if (o != null)
p.add(o);
}
} else {
Object o = node.jjtGetChild(i).jjtAccept(this, data);
if (o != null)
p.add(o);
}
}
p.add(Chunk.NEWLINE);
return p;
}
代码示例来源:origin: net.bull.javamelody/javamelody-core
Element createParagraphElement(String paragraphTitle, String iconName)
throws DocumentException, IOException {
final Paragraph paragraph = new Paragraph("", paragraphTitleFont);
paragraph.setSpacingBefore(5);
paragraph.setSpacingAfter(5);
if (iconName != null) {
paragraph.add(new Chunk(getParagraphImage(iconName), 0, -5));
}
final Phrase element = new Phrase(' ' + paragraphTitle, paragraphTitleFont);
element.setLeading(12);
paragraph.add(element);
// chapter pour avoir la liste des signets
final ChapterAutoNumber chapter = new ChapterAutoNumber(paragraph);
// sans numéro de chapitre
chapter.setNumberDepth(0);
chapter.setBookmarkOpen(false);
chapter.setTriggerNewPage(false);
return chapter;
}
代码示例来源:origin: com.github.linkeer8802/api-resolver-core
paAttrs.setSpacingAfter(8f);
代码示例来源:origin: com.github.librepdf/openpdf
/**
* Constructs a <CODE>Paragraph</CODE> with a certain <CODE>Phrase</CODE>.
*
* @param phrase a <CODE>Phrase</CODE>
*/
public Paragraph(Phrase phrase) {
super(phrase);
if (phrase instanceof Paragraph) {
Paragraph p = (Paragraph)phrase;
setAlignment(p.alignment);
setLeading(phrase.getLeading(), p.multipliedLeading);
setIndentationLeft(p.getIndentationLeft());
setIndentationRight(p.getIndentationRight());
setFirstLineIndent(p.getFirstLineIndent());
setSpacingAfter(p.spacingAfter());
setSpacingBefore(p.spacingBefore());
setExtraParagraphSpace(p.getExtraParagraphSpace());
}
}
代码示例来源:origin: fr.opensagres.xdocreport.itext-gae/itext-gae
/**
* Constructs a <CODE>Paragraph</CODE> with a certain <CODE>Phrase</CODE>.
*
* @param phrase a <CODE>Phrase</CODE>
*/
public Paragraph(Phrase phrase) {
super(phrase);
if (phrase instanceof Paragraph) {
Paragraph p = (Paragraph)phrase;
setAlignment(p.alignment);
setLeading(phrase.getLeading(), p.multipliedLeading);
setIndentationLeft(p.getIndentationLeft());
setIndentationRight(p.getIndentationRight());
setFirstLineIndent(p.getFirstLineIndent());
setSpacingAfter(p.spacingAfter());
setSpacingBefore(p.spacingBefore());
setExtraParagraphSpace(p.getExtraParagraphSpace());
}
}
代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext
/**
* Constructs a <CODE>Paragraph</CODE> with a certain <CODE>Phrase</CODE>.
*
* @param phrase a <CODE>Phrase</CODE>
*/
public Paragraph(Phrase phrase) {
super(phrase);
if (phrase instanceof Paragraph) {
Paragraph p = (Paragraph)phrase;
setAlignment(p.alignment);
setLeading(phrase.getLeading(), p.multipliedLeading);
setIndentationLeft(p.getIndentationLeft());
setIndentationRight(p.getIndentationRight());
setFirstLineIndent(p.getFirstLineIndent());
setSpacingAfter(p.spacingAfter());
setSpacingBefore(p.spacingBefore());
setExtraParagraphSpace(p.getExtraParagraphSpace());
}
}
代码示例来源:origin: qcadoo/mes
private void addPlaceForComments(Document document, Locale locale) throws DocumentException {
PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100f);
Paragraph paragraph = new Paragraph(new Phrase(translationService.translate(
"materialFlowResources.dispositionOrder.comments", locale), FontUtils.getDejavuBold7Dark()));
paragraph.setAlignment(Element.ALIGN_LEFT);
paragraph.setSpacingAfter(6f);
document.add(paragraph);
PdfPCell cell1 = new PdfPCell(new Paragraph(""));
cell1.setBorder(Rectangle.BOX);
cell1.setFixedHeight(60f);
table.addCell(cell1);
document.add(table);
document.add(Chunk.NEWLINE);
document.add(Chunk.NEWLINE);
}
内容来源于网络,如有侵权,请联系作者删除!