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


Java Paragraph.addAll方法代码示例

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


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

示例1: process

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
    HeaderNode hNode = (HeaderNode) node;
    int hLevel = hNode.getLevel();

    Sections sections = context.iTextContext().sections();

    Font font = sections.sectionTitlePrimaryFont(hLevel);
    context.pushFont(font);
    List<Element> subs = context.collectChildren(level, node);
    context.popFont();

    Paragraph p = new Paragraph();
    p.setFont(font);
    p.addAll(subs);

    Element element = sections.newSection(p, hLevel);
    context.append(element);
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:20,代码来源:HeaderNodeProcessor.java

示例2: end

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
@Override
public List<Element> end(WorkerContext ctx, Tag tag, List<Element> currentContent) {
    List<Element> elements = super.end(ctx, tag, currentContent);

    Paragraph paragraph = createParagraph();
    paragraph.addAll(elements);
    String content = paragraph.getContent();

    if (level == 1) {
        final Chapter chapter = configuration.createTitledChapter(content);
        return new ArrayList<Element>(1) {{
            add(chapter);
        }};
    }
    return elements;
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:17,代码来源:HeaderProcessor.java

示例3: process

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
    Font font = context.peekFont();

    BaseColor color = styles.getColor(Styles.BLOCKQUOTE_COLOR).or(BaseColor.LIGHT_GRAY);

    context.pushFont(new FontCopier(font).italic().color(color).get());
    List<Element> subs = context.collectChildren(level, node);
    context.popFont();

    Paragraph p = new Paragraph();
    p.addAll(subs);

    PdfPCell cell = new PdfPCell();
    cell.addElement(p);
    cell.setBorder(Rectangle.NO_BORDER);

    PdfPCell cellSymbol = new PdfPCell(
            new Phrase(context.symbol("quote-left", 24, color))
    );
    cellSymbol.setVerticalAlignment(Element.ALIGN_TOP);
    cellSymbol.setBorder(Rectangle.NO_BORDER);
    cellSymbol.setBorderWidthRight(1.0f);
    cellSymbol.setBorderColorRight(color);
    cellSymbol.setPaddingTop(0f);
    cellSymbol.setPaddingBottom(5f);
    cellSymbol.setPaddingLeft(10f);
    cellSymbol.setPaddingRight(0f);

    PdfPTable table = new PdfPTable(new float[]{1, 10});
    table.addCell(cellSymbol);
    table.addCell(cell);
    table.setSpacingBefore(20f);
    table.setSpacingAfter(20f);

    context.append(table);
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:38,代码来源:BlockQuoteNodeProcessor.java

示例4: process

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
    Attributes attrs = lookupAttributes(context);

    List<Element> subs = context.collectChildren(level, node);

    Paragraph p = new Paragraph();
    p.addAll(subs);

    PdfPCell cell = new PdfPCell();
    cell.addElement(p);
    cell.setBorderColor(BaseColor.LIGHT_GRAY);
    cell.setBorder(Rectangle.TOP + Rectangle.BOTTOM);
    cell.setPaddingTop(10f);
    cell.setPaddingBottom(10f);

    Styles styles = context.iTextContext().styles();
    BaseColor symbolColor = symbolColor(attrs, styles);
    PdfPCell cellSymbol = new PdfPCell(
            new Phrase(context.symbol(symbol(attrs), 24, symbolColor))
    );
    cellSymbol.setVerticalAlignment(Element.ALIGN_TOP);
    cellSymbol.setBorderColor(BaseColor.LIGHT_GRAY);
    cellSymbol.setBorder(Rectangle.TOP + Rectangle.BOTTOM);
    cellSymbol.setPaddingTop(10f);
    cellSymbol.setPaddingBottom(10f);
    cellSymbol.setPaddingLeft(0f);
    cellSymbol.setPaddingRight(10f);

    PdfPTable table = new PdfPTable(new float[]{1, 10});
    table.addCell(cellSymbol);
    table.addCell(cell);
    table.setSpacingBefore(20f);
    table.setSpacingAfter(20f);
    ITextUtils.applyAttributes(table, attrs);

    context.append(table);

}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:40,代码来源:GenericBoxNodeProcessor.java


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