com.itextpdf.text.Paragraph.getChunks()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中com.itextpdf.text.Paragraph.getChunks()方法的一些代码示例,展示了Paragraph.getChunks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Paragraph.getChunks()方法的具体详情如下:
包路径:com.itextpdf.text.Paragraph
类名称:Paragraph
方法名:getChunks

Paragraph.getChunks介绍

暂无

代码示例

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Constructs a <CODE>PdfOutline</CODE>.
 * <P>
 * This is the constructor for an <CODE>outline entry</CODE>.
 *
 * @param parent the parent of this outline item
 * @param action the <CODE>PdfAction</CODE> for this outline item
 * @param title the title of this outline item
 * @param open <CODE>true</CODE> if the children are visible
 */
public PdfOutline(PdfOutline parent, PdfAction action, Paragraph title, boolean open) {
  super();
  StringBuffer buf = new StringBuffer();
  for (Chunk chunk: title.getChunks()) {
    buf.append(chunk.getContent());
  }
  this.action = action;
  initOutline(parent, buf.toString(), open);
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Constructs a <CODE>PdfOutline</CODE>.
 * <P>
 * This is the constructor for an <CODE>outline entry</CODE>.
 *
 * @param parent the parent of this outline item
 * @param destination the destination for this outline item
 * @param title the title of this outline item
 * @param open <CODE>true</CODE> if the children are visible
 */
public PdfOutline(PdfOutline parent, PdfDestination destination, Paragraph title, boolean open) {
  super();
  StringBuffer buf = new StringBuffer();
  for (Object element : title.getChunks()) {
    Chunk chunk = (Chunk) element;
    buf.append(chunk.getContent());
  }
  this.destination = destination;
  initOutline(parent, buf.toString(), open);
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Constructs a <CODE>PdfOutline</CODE>.
 * <P>
 * This is the constructor for an <CODE>outline entry</CODE>.
 *
 * @param parent the parent of this outline item
 * @param action the <CODE>PdfAction</CODE> for this outline item
 * @param title the title of this outline item
 * @param open <CODE>true</CODE> if the children are visible
 */
public PdfOutline(PdfOutline parent, PdfAction action, Paragraph title, boolean open) {
  super();
  StringBuffer buf = new StringBuffer();
  for (Chunk chunk: title.getChunks()) {
    buf.append(chunk.getContent());
  }
  this.action = action;
  initOutline(parent, buf.toString(), open);
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Constructs a <CODE>PdfOutline</CODE>.
 * <P>
 * This is the constructor for an <CODE>outline entry</CODE>.
 *
 * @param parent the parent of this outline item
 * @param destination the destination for this outline item
 * @param title the title of this outline item
 * @param open <CODE>true</CODE> if the children are visible
 */
public PdfOutline(PdfOutline parent, PdfDestination destination, Paragraph title, boolean open) {
  super();
  StringBuffer buf = new StringBuffer();
  for (Object element : title.getChunks()) {
    Chunk chunk = (Chunk) element;
    buf.append(chunk.getContent());
  }
  this.destination = destination;
  initOutline(parent, buf.toString(), open);
}

代码示例来源:origin: com.itextpdf/itextpdf

/**
 * Adds a link to the current paragraph.
 * @since 5.0.6
 */
public void processLink() {
  if (currentParagraph == null) {
    currentParagraph = new Paragraph();
  }
  // The link provider allows you to do additional processing
  LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER);
  if (i == null || !i.process(currentParagraph, chain)) {
    // sets an Anchor for all the Chunks in the current paragraph
    String href = chain.getProperty(HtmlTags.HREF);
    if (href != null) {
      for (Chunk ck : currentParagraph.getChunks()) {
        ck.setAnchor(href);
      }
    }
  }
  // a link should be added to the current paragraph as a phrase
  if (stack.isEmpty()) {
    // no paragraph to add too, 'a' tag is first element
    Paragraph tmp = new Paragraph(new Phrase(currentParagraph));
    currentParagraph = tmp;
  } else {
    Paragraph tmp = (Paragraph) stack.pop();
    tmp.add(new Phrase(currentParagraph));
    currentParagraph = tmp;
  }
}

代码示例来源:origin: com.itextpdf/itextg

/**
 * Adds a link to the current paragraph.
 * @since 5.0.6
 */
public void processLink() {
  if (currentParagraph == null) {
    currentParagraph = new Paragraph();
  }
  // The link provider allows you to do additional processing
  LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER);
  if (i == null || !i.process(currentParagraph, chain)) {
    // sets an Anchor for all the Chunks in the current paragraph
    String href = chain.getProperty(HtmlTags.HREF);
    if (href != null) {
      for (Chunk ck : currentParagraph.getChunks()) {
        ck.setAnchor(href);
      }
    }
  }
  // a link should be added to the current paragraph as a phrase
  if (stack.isEmpty()) {
    // no paragraph to add too, 'a' tag is first element
    Paragraph tmp = new Paragraph(new Phrase(currentParagraph));
    currentParagraph = tmp;
  } else {
    Paragraph tmp = (Paragraph) stack.pop();
    tmp.add(new Phrase(currentParagraph));
    currentParagraph = tmp;
  }
}

相关文章