本文整理汇总了Java中com.itextpdf.text.Chapter类的典型用法代码示例。如果您正苦于以下问题:Java Chapter类的具体用法?Java Chapter怎么用?Java Chapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Chapter类属于com.itextpdf.text包,在下文中一共展示了Chapter类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addContent
import com.itextpdf.text.Chapter; //导入依赖的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);
}
开发者ID:fossaag,项目名称:rolp,代码行数:24,代码来源:PdfStreamSource.java
示例2: addIndividuelleEinschaetzung
import com.itextpdf.text.Chapter; //导入依赖的package包/类
private void addIndividuelleEinschaetzung(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException {
if (!lebData.getIndividuelleEinschaetzung().isEmpty()) {
sectionCount += 1;
breakHurenkind(writer);
breakSchusterjunge(writer);
Paragraph paragraphIndividuelleEinschaetzung = new Paragraph();
Section individuelleEinschaetzungsTextSection = chapterLEB.addSection(paragraphIndividuelleEinschaetzung);
individuelleEinschaetzungsTextSection.setNumberDepth(0);
Paragraph schuelereinschaetzungParapgraph = new Paragraph(lebData.getIndividuelleEinschaetzung().replace('\t', '\0'), standardTextFont);
schuelereinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
schuelereinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
individuelleEinschaetzungsTextSection.add(schuelereinschaetzungParapgraph);
document.add(individuelleEinschaetzungsTextSection);
document.add(getKlassenlehrerunterschrift(chapterLEB));
alertHurenkind(writer);
insertDummyLineIfNecessary(writer);
}
}
开发者ID:fossaag,项目名称:rolp,代码行数:19,代码来源:PdfStreamSource.java
示例3: addKlassenbrief
import com.itextpdf.text.Chapter; //导入依赖的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);
}
}
开发者ID:fossaag,项目名称:rolp,代码行数:25,代码来源:PdfStreamSource.java
示例4: end
import com.itextpdf.text.Chapter; //导入依赖的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
示例5: createPdf
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public void createPdf(String filename) throws DocumentException, IOException {
Document document = new Document(PageSize.LETTER);
PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
// step 4 - add content into document
for (int i = 1; i <= 10; i++) {
Chapter chapter = new Chapter(String.format("Chapter %s", i), i);
Section section = chapter.addSection("Section");
section.setIndentation(18);
section.add(new Paragraph("TestTestTestTestTestTestTestTestTestTestTestTest"));
for (int j = 1; j <= 3; j++) {
Section subSection = section.addSection("Sub Section");
subSection.add(new Paragraph("TestTestTestTestTestTestTestTestTestTestTestTest"));
}
document.add(chapter);
}
document.close();
}
开发者ID:kohmiho,项目名称:iTextTutorial,代码行数:24,代码来源:T08_Chapter.java
示例6: generateHeader
import com.itextpdf.text.Chapter; //导入依赖的package包/类
private Chapter generateHeader()
{
Font font = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 16, Font.BOLDITALIC, BaseColor.BLACK);
Chunk chunk = new Chunk(Localization.getString(Strings.REPORT_HEADLINE, date.toString("MMMM yyyy")), font);
Chapter chapter = new Chapter(new Paragraph(chunk), 1);
chapter.setNumberDepth(0);
chapter.add(Chunk.NEWLINE);
return chapter;
}
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:10,代码来源:ReportGenerator.java
示例7: addInvisibleChapterForHeader
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public void addInvisibleChapterForHeader(Document document, Section section) {
try {
Paragraph paragraph=new Paragraph(section.getSectionName(), FontFactory.getFont(FontFactory.COURIER,1f,BaseColor.WHITE));//hide chapter
Chapter chapter = new Chapter(paragraph,0);
document.add(chapter);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:ntenhoeve,项目名称:Introspect-Framework,代码行数:10,代码来源:PdfReportFactory.java
示例8: newSection
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public Section newSection(Paragraph sectionTitle, int hLevel, boolean numbered) {
if (hLevel < 1)
throw new IllegalArgumentException("Section hLevel starts at 1 (H1, H2, H3...)");
Arrays.fill(sections, hLevel, sections.length, null);
Section section;
if (hLevel == 1) {
if (numbered) // only increase chapter number if the number is used
chapterCount++;
Chapter chapter = new Chapter(sectionTitle, chapterCount);
sections[hLevel] = chapter;
chapters.add(chapter);
section = chapter;
} else {
Section parent = sections[hLevel - 1];
if (parent == null) {
throw new IllegalStateException("No parent section (depth H" + (hLevel - 1) + ") found");
}
sectionTitle.setSpacingBefore(20f);
section = parent.addSection(10.0f, sectionTitle);
sections[hLevel] = section;
}
if (!numbered)
section.setNumberDepth(0);
return section;
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:32,代码来源:Sections.java
示例9: h1_should_be_chapter
import com.itextpdf.text.Chapter; //导入依赖的package包/类
@Test
public void h1_should_be_chapter() {
Section section = sections.newSection(new Paragraph("Introduction"), 1);
assertThat(section).isInstanceOf(Chapter.class);
assertThat(sections.currentSection()).isSameAs(section);
assertThat(sections.sections()).isEqualTo(new Section[]{null, section, null, null, null, null, null, null, null, null});
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:9,代码来源:SectionsTest.java
示例10: createPdf
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public void createPdf(String filename) throws DocumentException, IOException {
Document document = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
// TODO: 3. get imported page
PdfReader stationery = new PdfReader(T11_ColumnText.RESULT);
PdfImportedPage page = writer.getImportedPage(stationery, 1);
writer.setPageEvent(new HeaderFooter(page));
document.open();
// step 4 - add content into document
for (int i = 1; i <= 10; i++) {
Chapter chapter = new Chapter(String.format("Chapter %s", i), i);
Section section = chapter.addSection("Section");
section.add(new Paragraph("TestTestTestTestTestTestTestTestTestTestTestTest"));
for (int j = 1; j <= 3; j++) {
Section subSection = section.addSection("Sub Section");
subSection.add(new Paragraph("TestTestTestTestTestTestTestTestTestTestTestTest"));
}
document.add(chapter);
}
document.close();
}
开发者ID:kohmiho,项目名称:iTextTutorial,代码行数:29,代码来源:T13_ImportStationery.java
示例11: parseURL2PDFFile
import com.itextpdf.text.Chapter; //导入依赖的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
示例12: addFacheinschaetzungen
import com.itextpdf.text.Chapter; //导入依赖的package包/类
private void addFacheinschaetzungen(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException {
for (LebFacheinschaetzungData facheinschaetzungsdaten : lebData.getFacheinschaetzungsdaten()) {
sectionCount += 1;
breakHurenkind(writer);
breakSchusterjunge(writer);
Paragraph paragraphFacheinschaetzung = new Paragraph();
Section facheinschaetzungsTextSection = chapterLEB.addSection(paragraphFacheinschaetzung);
facheinschaetzungsTextSection.setNumberDepth(0);
Collection<String> fachbezeichnungen = facheinschaetzungsdaten.getFachbezeichnungen();
fachbezeichnungen.add(facheinschaetzungsdaten.getFachname());
String facheinschaetzung = facheinschaetzungsdaten.getFacheinschaetzung();
Integer firstIndex = null;
String boldedWord = "";
for (String fachbezeichnung : fachbezeichnungen) {
int index = facheinschaetzung.toLowerCase().indexOf(fachbezeichnung.toLowerCase());
if (index != -1 && (firstIndex == null || firstIndex > index)) {
firstIndex = index;
boldedWord = fachbezeichnung;
}
}
Paragraph facheinschaetzungParapgraph = new Paragraph();
facheinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
facheinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
if (firstIndex == null) {
facheinschaetzungParapgraph.add(new Phrase(facheinschaetzungsdaten.getFacheinschaetzung().replace('\t', '\0'), standardTextFont));
} else {
String beforeBoldWord = facheinschaetzung.substring(0, firstIndex);
facheinschaetzungParapgraph.add(new Phrase(beforeBoldWord.replace('\t', '\0'), standardTextFont));
String boldWord = facheinschaetzung.substring(firstIndex, firstIndex + boldedWord.length());
facheinschaetzungParapgraph.add(new Phrase(boldWord, standardTextBoldFont));
String afterBoldWord = facheinschaetzung.substring(firstIndex + boldedWord.length());
facheinschaetzungParapgraph.add(new Phrase(afterBoldWord.replace('\t', '\0'), standardTextFont));
}
facheinschaetzungParapgraph.setFont(standardTextFont);
facheinschaetzungsTextSection.add(facheinschaetzungParapgraph);
Paragraph unterschriftParagraph = new Paragraph();
document.add(facheinschaetzungsTextSection);
Section facheinschaetzungsUnterschriftSection = chapterLEB.addSection(unterschriftParagraph);
facheinschaetzungsUnterschriftSection.setNumberDepth(0);
unterschriftParagraph.add(new Phrase(facheinschaetzungsdaten.getUnterschrift().replace('\t', '\0'), standardTextFont));
unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT);
unterschriftParagraph.add(Chunk.NEWLINE);
unterschriftParagraph.add(Chunk.NEWLINE);
document.add(facheinschaetzungsUnterschriftSection);
alertHurenkind(writer);
insertDummyLineIfNecessary(writer);
}
}
开发者ID:fossaag,项目名称:rolp,代码行数:53,代码来源:PdfStreamSource.java
示例13: restoreChapter
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public void restoreChapter(Chapter chapter) {
sections[1] = chapter;
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:4,代码来源:Sections.java
示例14: currentChapter
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public Chapter currentChapter() {
return (Chapter) sections[1];
}
开发者ID:Arnauld,项目名称:gutenberg,代码行数:4,代码来源:Sections.java
示例15: createChapter
import com.itextpdf.text.Chapter; //导入依赖的package包/类
public static Chapter createChapter(String chapterName, int chapterNumber) {
Anchor anchor = new Anchor(chapterName, HEADER_FONT);
anchor.setName(chapterName);
Chapter chapter = new Chapter(new Paragraph(chapterName, CAT_FONT), chapterNumber);
return chapter;
}
开发者ID:NimbleGen,项目名称:bioinformatics,代码行数:7,代码来源:PdfReportUtil.java
示例16: addContent
import com.itextpdf.text.Chapter; //导入依赖的package包/类
private static void addContent(Document document,String msg) throws DocumentException {
Paragraph preface = new Paragraph("Przebieg: ",smallBold);
Chapter catPart = new Chapter(preface, 1);
addEmptyLine(preface, 1);
preface.add(msg);
document.add(catPart);
}
开发者ID:apawel,项目名称:Dziennik-Szkolny,代码行数:16,代码来源:GeneratePDFZeb.java
注:本文中的com.itextpdf.text.Chapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论