• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Section类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.itextpdf.text.Section的典型用法代码示例。如果您正苦于以下问题:Java Section类的具体用法?Java Section怎么用?Java Section使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Section类属于com.itextpdf.text包,在下文中一共展示了Section类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addContent

import com.itextpdf.text.Section; //导入依赖的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.Section; //导入依赖的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.Section; //导入依赖的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: createPdf

import com.itextpdf.text.Section; //导入依赖的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


示例5: createList

import com.itextpdf.text.Section; //导入依赖的package包/类
private static void createList(Section subCatPart) {
  List list = new List(true, false, 10);
  list.add(new ListItem("First point"));
  list.add(new ListItem("Second point"));
  list.add(new ListItem("Third point"));
  subCatPart.add(list);
}
 
开发者ID:gonzapala,项目名称:CPI,代码行数:8,代码来源:generarPDF.java


示例6: getKlassenlehrerunterschrift

import com.itextpdf.text.Section; //导入依赖的package包/类
private Section getKlassenlehrerunterschrift(Section chapterLEB) {
	Paragraph unterschriftParagraph = new Paragraph();
	Section klassenbriefUnterschriftSection = chapterLEB.addSection(unterschriftParagraph);
	klassenbriefUnterschriftSection.setNumberDepth(0);
	unterschriftParagraph.add(new Phrase(lebData.getKlassenlehrerUnterschrift().replace('\t', '\0'), standardTextFont));
	unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT);
	unterschriftParagraph.add(Chunk.NEWLINE);
	unterschriftParagraph.add(Chunk.NEWLINE);			
	return klassenbriefUnterschriftSection;
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:11,代码来源:PdfStreamSource.java


示例7: newSection

import com.itextpdf.text.Section; //导入依赖的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


示例8: currentSection

import com.itextpdf.text.Section; //导入依赖的package包/类
public Section currentSection() {
    Section prev = null;
    for (int i = 1; i < sections.length; i++) {
        Section section = sections[i];
        if (section != null) {
            prev = section;
        } else {
            break;
        }
    }
    return prev;
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:13,代码来源:Sections.java


示例9: h1_should_be_chapter

import com.itextpdf.text.Section; //导入依赖的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: h2_should_be_section

import com.itextpdf.text.Section; //导入依赖的package包/类
@Test
public void h2_should_be_section() {
    Section chapter = sections.newSection(new Paragraph("Getting Started"), 1);
    Section section = sections.newSection(new Paragraph("Introduction"), 2);

    assertThat(section).isInstanceOf(Section.class);
    assertThat(sections.currentSection()).isSameAs(section);
    assertThat(sections.sections()).isEqualTo(new Section[]{null, chapter, section, null, null, null, null, null, null, null});
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:10,代码来源:SectionsTest.java


示例11: h3_should_be_section

import com.itextpdf.text.Section; //导入依赖的package包/类
@Test
public void h3_should_be_section() {
    Section chapter = sections.newSection(new Paragraph("Organizational Challenges"), 1);
    Section sectionChapter = sections.newSection(new Paragraph("Cultural Challenges"), 2);
    Section section1 = sections.newSection(new Paragraph("Organizational culture"), 3);

    assertThat(section1).isInstanceOf(Section.class);
    assertThat(sections.currentSection()).isSameAs(section1);
    assertThat(sections.sections()).isEqualTo(new Section[]{null, chapter, sectionChapter, section1, null, null, null, null, null, null});
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:11,代码来源:SectionsTest.java


示例12: new_h3_should_replace_previous_h3

import com.itextpdf.text.Section; //导入依赖的package包/类
@Test
public void new_h3_should_replace_previous_h3() {
    Section chapter = sections.newSection(new Paragraph("Organizational Challenges"), 1);
    Section sectionChapter = sections.newSection(new Paragraph("Cultural Challenges"), 2);
    Section section1 = sections.newSection(new Paragraph("Organizational culture"), 3);
    Section section2 = sections.newSection(new Paragraph("Barrier to success"), 3);

    assertThat(section2).isInstanceOf(Section.class);
    assertThat(sections.currentSection()).isSameAs(section2);
    assertThat(sections.sections()).isEqualTo(new Section[]{null, chapter, sectionChapter, section2, null, null, null, null, null, null});
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:12,代码来源:SectionsTest.java


示例13: new_h2_should_discard_previous_h3

import com.itextpdf.text.Section; //导入依赖的package包/类
@Test
public void new_h2_should_discard_previous_h3() {
    Section chapter = sections.newSection(new Paragraph("Organizational Challenges"), 1);
    Section sectionChapter1 = sections.newSection(new Paragraph("Cultural Challenges"), 2);
    Section section1 = sections.newSection(new Paragraph("Organizational culture"), 3);
    Section section2 = sections.newSection(new Paragraph("Barrier to success"), 3);
    Section sectionChapter2 = sections.newSection(new Paragraph("Team Logistics"), 2);

    assertThat(sections.currentSection()).isSameAs(sectionChapter2);
    assertThat(sections.sections()).isEqualTo(new Section[]{null, chapter, sectionChapter2, null, null, null, null, null, null, null});
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:12,代码来源:SectionsTest.java


示例14: createPdf

import com.itextpdf.text.Section; //导入依赖的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


示例15: parseURL2PDFFile

import com.itextpdf.text.Section; //导入依赖的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


示例16: addFacheinschaetzungen

import com.itextpdf.text.Section; //导入依赖的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


示例17: sections

import com.itextpdf.text.Section; //导入依赖的package包/类
@VisibleForTesting
Section[] sections() {
    return sections;
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:5,代码来源:Sections.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultGoApiResponse类代码示例发布时间:2022-05-22
下一篇:
Java WebSecurityExpressionRoot类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap