annotations

jsPDF 注释插件

PDF 文档中有多种类型的注释。注释被放置在页面的特定位置,它们并不"附加"到某个对象上。
当前插件支持以下功能:

  • 跳转到页面(在 options 中设置 pageNumber 和 top)
  • 跳转到名称(在 options 中设置 name 和 top)
  • 跳转到 URL(在 options 中设置 url)

    当跳转目标是页码或命名目标时,还可以指定目标放大倍数(见下文文档) (在 options 中设置 magFactor)。XYZ 是默认值。

    支持链接、文本、弹出框和自由文本注释。

    PDF 规范中尚未实现的功能:

  • 链接边框
  • 命名目标
  • 页面坐标
  • 目标页面缩放和布局
  • 除 URL 和 GotoPage 之外的操作
  • 背景/悬停操作

  • Source:

    Methods

    (inner) createAnnotation(options)

    Source:
    Parameters:
    Name Type Description
    options Object

    (inner) getTextWidth(text) → {number}

    Source:
    Parameters:
    Name Type Description
    text string
    Returns:

    txtWidth

    Type
    number
    Source:

    创建一个链接

    有效的选项

  • pageNumber 或 url [required]

    如果指定了 pageNumber,还可以指定 top 和 zoom

  • Parameters:
    Name Type Description
    x number
    y number
    w number
    h number
    options Object
    Source:

    目前仅支持单行文本。

    返回文本/链接的宽度

    参数:
    Name Type Description
    text string
    x number
    y number
    options Object
    Returns:

    width 文本/链接的宽度

    Type
    number