Package com.itextpdf.text

Examples of com.itextpdf.text.Section


                }
                case Element.SECTION:
                case Element.CHAPTER: {
                    // Chapters and Sections only differ in their constructor
                    // so we cast both to a Section
                    Section section = (Section) element;
                    PdfPageEvent pageEvent = writer.getPageEvent();

                    boolean hasTitle = section.isNotAddedYet()
                      && section.getTitle() != null;

                    // if the section is a chapter, we begin a new page
                    if (section.isTriggerNewPage()) {
                        newPage();
                    }

                    if (hasTitle) {
                      float fith = indentTop() - currentHeight;
                      int rotation = pageSize.getRotation();
                      if (rotation == 90 || rotation == 180)
                        fith = pageSize.getHeight() - fith;
                      PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
                      while (currentOutline.level() >= section.getDepth()) {
                        currentOutline = currentOutline.parent();
                      }
                      PdfOutline outline = new PdfOutline(currentOutline, destination, section.getBookmarkTitle(), section.isBookmarkOpen());
                      currentOutline = outline;
                    }

                    // some values are set
                    carriageReturn();
                    indentation.sectionIndentLeft += section.getIndentationLeft();
                    indentation.sectionIndentRight += section.getIndentationRight();

                    if (section.isNotAddedYet() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapter(writer, this, indentTop() - currentHeight, section.getTitle());
                        else
                            pageEvent.onSection(writer, this, indentTop() - currentHeight, section.getDepth(), section.getTitle());

                    // the title of the section (if any has to be printed)
                    if (hasTitle) {
                        isSectionTitle = true;
                        add(section.getTitle());
                        isSectionTitle = false;
                    }
                    indentation.sectionIndentLeft += section.getIndentation();
                    // we process the section
                    element.process(this);
                    flushLines();
                    // some parameters are set back to normal again
                    indentation.sectionIndentLeft -= section.getIndentationLeft() + section.getIndentation();
                    indentation.sectionIndentRight -= section.getIndentationRight();

                    if (section.isComplete() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapterEnd(writer, this, indentTop() - currentHeight);
                        else
                            pageEvent.onSectionEnd(writer, this, indentTop() - currentHeight);
View Full Code Here


                }
                case Element.SECTION:
                case Element.CHAPTER: {
                    // Chapters and Sections only differ in their constructor
                    // so we cast both to a Section
                    Section section = (Section) element;
                    PdfPageEvent pageEvent = writer.getPageEvent();

                    boolean hasTitle = section.isNotAddedYet()
                      && section.getTitle() != null;

                    // if the section is a chapter, we begin a new page
                    if (section.isTriggerNewPage()) {
                        newPage();
                    }

                    if (hasTitle) {
                      float fith = indentTop() - currentHeight;
                      int rotation = pageSize.getRotation();
                      if (rotation == 90 || rotation == 180)
                        fith = pageSize.getHeight() - fith;
                      PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
                      while (currentOutline.level() >= section.getDepth()) {
                        currentOutline = currentOutline.parent();
                      }
                      PdfOutline outline = new PdfOutline(currentOutline, destination, section.getBookmarkTitle(), section.isBookmarkOpen());
                      currentOutline = outline;
                    }

                    // some values are set
                    carriageReturn();
                    indentation.sectionIndentLeft += section.getIndentationLeft();
                    indentation.sectionIndentRight += section.getIndentationRight();

                    if (section.isNotAddedYet() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapter(writer, this, indentTop() - currentHeight, section.getTitle());
                        else
                            pageEvent.onSection(writer, this, indentTop() - currentHeight, section.getDepth(), section.getTitle());

                    // the title of the section (if any has to be printed)
                    if (hasTitle) {
                        isSectionTitle = true;
                        add(section.getTitle());
                        isSectionTitle = false;
                    }
                    indentation.sectionIndentLeft += section.getIndentation();
                    // we process the section
                    element.process(this);
                    flushLines();
                    // some parameters are set back to normal again
                    indentation.sectionIndentLeft -= section.getIndentationLeft() + section.getIndentation();
                    indentation.sectionIndentRight -= section.getIndentationRight();

                    if (section.isComplete() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapterEnd(writer, this, indentTop() - currentHeight);
                        else
                            pageEvent.onSectionEnd(writer, this, indentTop() - currentHeight);
View Full Code Here

                }
                case Element.SECTION:
                case Element.CHAPTER: {
                    // Chapters and Sections only differ in their constructor
                    // so we cast both to a Section
                    Section section = (Section) element;
                    PdfPageEvent pageEvent = writer.getPageEvent();

                    boolean hasTitle = section.isNotAddedYet()
                      && section.getTitle() != null;

                    // if the section is a chapter, we begin a new page
                    if (section.isTriggerNewPage()) {
                        newPage();
                    }

                    if (hasTitle) {
                      float fith = indentTop() - currentHeight;
                      int rotation = pageSize.getRotation();
                      if (rotation == 90 || rotation == 180)
                        fith = pageSize.getHeight() - fith;
                      PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
                      while (currentOutline.level() >= section.getDepth()) {
                        currentOutline = currentOutline.parent();
                      }
                      PdfOutline outline = new PdfOutline(currentOutline, destination, section.getBookmarkTitle(), section.isBookmarkOpen());
                      currentOutline = outline;
                    }

                    // some values are set
                    carriageReturn();
                    indentation.sectionIndentLeft += section.getIndentationLeft();
                    indentation.sectionIndentRight += section.getIndentationRight();

                    if (section.isNotAddedYet() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapter(writer, this, indentTop() - currentHeight, section.getTitle());
                        else
                            pageEvent.onSection(writer, this, indentTop() - currentHeight, section.getDepth(), section.getTitle());

                    // the title of the section (if any has to be printed)
                    if (hasTitle) {
                        isSectionTitle = true;
                        add(section.getTitle());
                        isSectionTitle = false;
                    }
                    indentation.sectionIndentLeft += section.getIndentation();
                    // we process the section
                    element.process(this);
                    flushLines();
                    // some parameters are set back to normal again
                    indentation.sectionIndentLeft -= section.getIndentationLeft() + section.getIndentation();
                    indentation.sectionIndentRight -= section.getIndentationRight();

                    if (section.isComplete() && pageEvent != null)
                        if (element.type() == Element.CHAPTER)
                            pageEvent.onChapterEnd(writer, this, indentTop() - currentHeight);
                        else
                            pageEvent.onSectionEnd(writer, this, indentTop() - currentHeight);
View Full Code Here

   * Creates a Section object based on a list of properties.
   * @param attributes
   * @return a Section
   */
  public static Section getSection(Section parent, Properties attributes) {
    Section section = parent.addSection("");
    setSectionParameters(section, attributes);
    return section;
  }
View Full Code Here

    Anchor anchor = new Anchor(a.get(j).get(0).toString(), catFont);
    anchor.setName(a.get(j).get(0).toString());
    catPart = new Chapter(new Paragraph(anchor), k);

    Paragraph subPara = new Paragraph("Prononciation: ", subFont);
    Section subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph(a.get(j).get(1).toString()));

    subPara = new Paragraph("Nature: ", subFont);
    subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph(a.get(j).get(2).toString()));
 
    subPara = new Paragraph("D�finition: ", subFont);
    subCatPart = catPart.addSection(subPara);
    subCatPart.add(new Paragraph(a.get(j).get(3).toString()));
    document.add(catPart);

      k++;
      }
    }
View Full Code Here

    String bizTitle = biz.getName();
    // 业务标题
    Paragraph pBiz = new Paragraph(bizTitle, Fonts.FONT_TITILE2);
    // 业务章节
    Section sBiz = parentSection.addSection(pBiz);
    if (biz.isHasImg()) {
      // 表关系章节
      buildTableRelationship(sBiz, biz);
    }
    // 表清单章节
View Full Code Here

    String title = biz.getName() + "接口表明细";
    // 明细标题
    Paragraph pTitle = new Paragraph(title, Fonts.FONT_TITILE2);

    // 表明细章节
    Section section = parentSection.addSection(pTitle);
    // 循环生成表树的结构
    List<TableTree> tableTrees = biz.getTableTrees();
    if (tableTrees == null) {
      return;
    }
View Full Code Here

    }
    title= title+"("+code+")";
    // 表结构标题
    Paragraph pTitle = new Paragraph(title, Fonts.FONT_TITILE3);
    // 表结构章节
    Section section = parentSection.addSection(pTitle);
    // 生成表结构
    TableInfo tableInfo = tables.get(code);
    addTable(section, tableInfo);
    // 递归子表数
    List<TableTree> subs = tableTree.getSubTables();
View Full Code Here

      throws MalformedURLException, IOException, DocumentException {
    String title = biz.getName() + "关系图";
    // 表关系图标题
    Paragraph pTableImageTitle = new Paragraph(title, Fonts.FONT_TITILE2);
    // 表关系图章节
    Section sTableImage = parentSection.addSection(pTableImageTitle);

    String img = "/table_rel/" + biz.getCode() + ".png";
    LOG.info("加载关系图[{}]", img);
    // 表关系图
    Image iTableImg = Image.getInstance(
        PdfGenerator.class.getResource(img), true);
    iTableImg.scaleToFit(360f, 480f);
    // iTableImg.setAlignment(Image.MIDDLE);
    iTableImg.setIndentationLeft(20f);
    // iTableImg.setBorder(10);
    // iTableImg.setBorderColor(BaseColor.GREEN);
    // iTableImg.setBorderWidth(4);
    iTableImg.setAlignment(Image.LEFT);
    // iTableImg.enableBorderSide(Rectangle.BOX);
    iTableImg.setSpacingBefore(10f);
    iTableImg.setSpacingAfter(10);

    // iTableImg.setAbsolutePosition(
    // (PageSize.POSTCARD.getWidth()
    // - iTableImg.getScaledWidth()) / 2,
    // (PageSize.POSTCARD.getHeight()
    // -iTableImg.getScaledHeight()) / 2);
    //
    // writer.getDirectContent().addImage(iTableImg);

    sTableImage.add(iTableImg);
    // Chunk c = new Chunk("xxxxx", Fonts.FONT_TITILE1);
    // c.setNewPage();
    // sTableImage.add(c);
    // sTableImage.setComplete(true);
    // Chunk c = new Chunk();
View Full Code Here

    String title = biz.getName() + "表清单";
    // 表清单标题
    Paragraph pTableListTitle = new Paragraph(title, Fonts.FONT_TITILE2);
    pTableListTitle.setExtraParagraphSpace(10);
    // 表清单章节
    Section sTableList = parentSection.addSection(pTableListTitle);

    int count = Helper.calcTableCount(biz.getTableTrees());
    // 表清单说明
    Paragraph someSectionText = new Paragraph(biz.getName() + "业务共包括"
        + count + "张业务信息接口表", Fonts.FONT_MAIN_TEXT);
    someSectionText.setSpacingBefore(10);
    someSectionText.setFirstLineIndent(30);
    sTableList.add(someSectionText);
    // 表清单表格
    PdfPTable tTableList = buildTableList(sTableList, biz);
    sTableList.add(tTableList);

    pTableListTitle.setAlignment(Paragraph.ALIGN_LEFT);
  }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.