本文整理汇总了Java中com.itextpdf.text.pdf.draw.LineSeparator类的典型用法代码示例。如果您正苦于以下问题:Java LineSeparator类的具体用法?Java LineSeparator怎么用?Java LineSeparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineSeparator类属于com.itextpdf.text.pdf.draw包,在下文中一共展示了LineSeparator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: emit
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
private void emit(String fontName, String encoding) throws DocumentException, IOException {
String text = "" +
"(defn year-end-evaluation\n" +
" []\n" +
" (if (> (rand) 0.5)\n" +
" \"You get a raise!\"\n" +
" \"Better luck next year!\"))";
BaseFont bf = BaseFont.createFont(fontName, encoding, BaseFont.EMBEDDED);
document.add(new Paragraph(String.format("Font file: %s with encoding %s", fontName, encoding)));
document.add(new Paragraph(String.format("iText class: %s", bf.getClass().getName())));
Font font = new Font(bf, 12);
document.add(new Paragraph(text, font));
document.add(new LineSeparator(0.5f, 100, null, 0, -5));
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:17,代码来源:InconsolataFontPdfTest.java
示例2: generateTableOfContent
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
private ColumnText generateTableOfContent() {
ColumnText ct = new ColumnText(null);
Chunk CONNECT = new Chunk(new LineSeparator(0.5f, 95, configuration.defaultColor(), Element.ALIGN_CENTER, -.5f));
Paragraph paragraph = new Paragraph();
paragraph.setSpacingBefore(20.0f); // first paragraph only
ct.addElement(new Paragraph("Table of content", configuration.chapterTitleFont()));
ct.addElement(new Paragraph(""));
for (TableOfContents.Entry entry : tableOfContents.getEntries()) {
if (entry.isExtra())
continue;
Chunk chunk = new Chunk(entry.getText(), configuration.tocEntryFont());
paragraph.add(chunk);
paragraph.add(CONNECT);
paragraph.add(new Chunk("" + entry.getFormattedPageNumber(), configuration.tocEntryFont()));
float indent = 10.0f * entry.getLevel();
paragraph.setIndentationLeft(indent);
ct.addElement(paragraph);
paragraph = new Paragraph();
}
return ct;
}
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:28,代码来源:PdfEmitter.java
示例3: buildComponent
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
@Override
public void buildComponent(SerialisationContext pSerialisationContext, PDFSerialiser pSerialiser, EvaluatedHtmlPresentationNode pEvalNode) {
Paragraph lParagraph = pSerialiser.getElementFactory().getParagraph();
LineSeparator lLineSeparator = pSerialiser.getElementFactory().getLineSeparator();
lParagraph.add(new Chunk(lLineSeparator));
pSerialiser.add(lParagraph);
}
开发者ID:Fivium,项目名称:FOXopen,代码行数:9,代码来源:HorizontalRuleComponentBuilder.java
示例4: emit
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
private void emit(String fontName, String encoding) throws DocumentException, IOException {
BaseFont bf = BaseFont.createFont(fontName, encoding, BaseFont.EMBEDDED);
document.add(new Paragraph(String.format("Font file: %s with encoding %s", fontName, encoding)));
document.add(new Paragraph(String.format("iText class: %s", bf.getClass().getName())));
Font font = new Font(bf, 12);
document.add(new Paragraph(TEXT, font));
document.add(new LineSeparator(0.5f, 100, null, 0, -5));
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:9,代码来源:FontawesomePdfTest.java
示例5: parseURL2PDFFile
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
/**
* 直接把网页内容转为PDF文件
*
* @param fileName
* @throws Exception
*/
public static void parseURL2PDFFile(String pdfFile, String blogURL)
throws Exception {
BaseFont bfCN = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H",
false);
// 中文字体定义
Font chFont = new Font(bfCN, 14, Font.NORMAL, BaseColor.BLUE);
Font secFont = new Font(bfCN, 12, Font.NORMAL, new BaseColor(0, 204,
255));
Font textFont = new Font(bfCN, 12, Font.NORMAL, BaseColor.BLACK);
Document document = new Document();
PdfWriter pdfwriter = PdfWriter.getInstance(document,
new FileOutputStream(pdfFile));
pdfwriter.setViewerPreferences(PdfWriter.HideToolbar);
document.open();
String[] blogInfo = extractBlogInfo(blogURL);
int chNum = 1;
Chapter chapter = new Chapter(new Paragraph("URL转PDF测试", chFont),
chNum++);
Section section = chapter
.addSection(new Paragraph(blogInfo[0], secFont));
section.setIndentation(10);
section.setIndentationLeft(10);
section.setBookmarkOpen(false);
section.setNumberStyle(Section.NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT);
section.add(new Chunk("分类:" + blogInfo[1] + " 日期:" + blogInfo[2],
textFont));
LineSeparator line = new LineSeparator(1, 100, new BaseColor(204, 204,
204), Element.ALIGN_CENTER, -2);
Paragraph p_line = new Paragraph(" ");
p_line.add(line);
section.add(p_line);
section.add(Chunk.NEWLINE);
document.add(chapter);
// html文件
XMLWorkerHelper.getInstance().parseXHtml(pdfwriter, document,
parse2Stream(blogInfo[3]));
document.close();
}
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:54,代码来源:Demo4URL2PDF.java
示例6: getLineSeparator
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
/**
* Create a line separator item with the factory element attributes applied
* @return A line separator item with the element attributes applied
*/
public LineSeparator getLineSeparator() {
LineSeparator lLineSeparator = new LineSeparator();
return lLineSeparator;
}
开发者ID:Fivium,项目名称:FOXopen,代码行数:9,代码来源:ElementFactory.java
示例7: connectChunk
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
private Chunk connectChunk(Styles styles) {
return new Chunk(new LineSeparator(0.5f, 95, styles.defaultColor(), Element.ALIGN_CENTER, -.5f));
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:4,代码来源:TableOfContentsPostProcessor.java
示例8: process
import com.itextpdf.text.pdf.draw.LineSeparator; //导入依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
List<Element> subs = context.collectChildren(level, node);
SimpleNode tNode = (SimpleNode) node;
SimpleNode.Type type = tNode.getType();
switch (type) {
case Apostrophe:
context.append(new Chunk("'"));
return;
case Ellipsis:
context.append(new Chunk("\u2026"));
return;
case Emdash:
context.append(new Chunk("\u2014"));
return;
case Endash:
context.append(new Chunk("\u2013"));
return;
case HRule:
LineSeparator lineSeparator = new LineSeparator();
lineSeparator.setLineColor(lineColor);
lineSeparator.setLineWidth(lineWidth);
Paragraph p = new Paragraph();
p.add(lineSeparator);
p.add(Chunk.NEWLINE);
context.append(p);
return;
case Linebreak:
int len = tNode.getEndIndex() - tNode.getStartIndex();
StringBuilder b = new StringBuilder();
for(int i=0;i<(len - 1);i++) {
b.append(' ');
}
b.append('\n');
context.append(new Chunk(b.toString()));
return;
case Nbsp:
context.append(new Chunk("\u00a0"));
return;
default:
log.warn("Unsupported type '{}'", type);
context.appendAll(subs);
}
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:46,代码来源:SimpleNodeProcessor.java
注:本文中的com.itextpdf.text.pdf.draw.LineSeparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论