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

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

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

Paragraph.setLeading介绍

暂无

代码示例

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

/**
 * Sets the leading of a Paragraph object.
 * @param    paragraph    the Paragraph for which we set the leading
 * @param    leading        the String value of the leading
 */
protected static void setParagraphLeading(final Paragraph paragraph, final String leading) {
  // default leading
  if (leading == null) {
    paragraph.setLeading(0, 1.5f);
    return;
  }
  try {
    StringTokenizer tk = new StringTokenizer(leading, " ,");
    // absolute leading
    String v = tk.nextToken();
    float v1 = Float.parseFloat(v);
    if (!tk.hasMoreTokens()) {
      paragraph.setLeading(v1, 0);
      return;
    }
    // relative leading
    v = tk.nextToken();
    float v2 = Float.parseFloat(v);
    paragraph.setLeading(v1, v2);
  } catch (Exception e) {
    // default leading
    paragraph.setLeading(0, 1.5f);
  }
}

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

/**
 * Sets the leading of a Paragraph object.
 * @param    paragraph    the Paragraph for which we set the leading
 * @param    leading        the String value of the leading
 */
protected static void setParagraphLeading(final Paragraph paragraph, final String leading) {
  // default leading
  if (leading == null) {
    paragraph.setLeading(0, 1.5f);
    return;
  }
  try {
    StringTokenizer tk = new StringTokenizer(leading, " ,");
    // absolute leading
    String v = tk.nextToken();
    float v1 = Float.parseFloat(v);
    if (!tk.hasMoreTokens()) {
      paragraph.setLeading(v1, 0);
      return;
    }
    // relative leading
    v = tk.nextToken();
    float v2 = Float.parseFloat(v);
    paragraph.setLeading(v1, v2);
  } catch (Exception e) {
    // default leading
    paragraph.setLeading(0, 1.5f);
  }
}

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

protected void populateProperties(Paragraph copy, boolean spacingBefore) {
  copy.setFont(getFont());
  copy.setAlignment(getAlignment());
  copy.setLeading(getLeading(), multipliedLeading);
  copy.setIndentationLeft(getIndentationLeft());
  copy.setIndentationRight(getIndentationRight());
  copy.setFirstLineIndent(getFirstLineIndent());
  copy.setSpacingAfter(getSpacingAfter());
  if (spacingBefore)
    copy.setSpacingBefore(getSpacingBefore());
  copy.setExtraParagraphSpace(getExtraParagraphSpace());
  copy.setRole(role);
  copy.id = getId();
  if (accessibleAttributes != null)
    copy.accessibleAttributes = new HashMap<PdfName, PdfObject>(accessibleAttributes);
  copy.setTabSettings(getTabSettings());
  copy.setKeepTogether(getKeepTogether());
}

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

protected void populateProperties(Paragraph copy, boolean spacingBefore) {
  copy.setFont(getFont());
  copy.setAlignment(getAlignment());
  copy.setLeading(getLeading(), multipliedLeading);
  copy.setIndentationLeft(getIndentationLeft());
  copy.setIndentationRight(getIndentationRight());
  copy.setFirstLineIndent(getFirstLineIndent());
  copy.setSpacingAfter(getSpacingAfter());
  if (spacingBefore)
    copy.setSpacingBefore(getSpacingBefore());
  copy.setExtraParagraphSpace(getExtraParagraphSpace());
  copy.setRole(role);
  copy.id = getId();
  if (accessibleAttributes != null)
    copy.accessibleAttributes = new HashMap<PdfName, PdfObject>(accessibleAttributes);
  copy.setTabSettings(getTabSettings());
  copy.setKeepTogether(getKeepTogether());
}

相关文章