跳转至

PDF Viewer(PDF 查看器)

The PDF Viewer widget supports basic capabilities such as keyword search with text highlighting and auto-scroll on match, as well as more complex capabilities such as the ability to display, create, and interact with text and area annotations, enabling user tagging workflows.

PDF Viewer

PDF Viewer with annotations.

The capability provides many enhanced functionalities including, but not limited to, the following:

  • Accepting string variables for keyword matches throughout the document.
  • Built-in search functionality for keyword matches provided by user.
  • Match highlighting (green for current match; purple for others) and hit count display.
  • Snaps to first result and between other hits.
  • Supports MediaReferences (media sets).
  • Displaying existing annotation objects.
  • Creating annotations through configured actions.
  • Customizable annotation interactions including events on selection, property display tooltips, and custom color highlighting.

Configuration options

The widget configuration supports several media input sources along with variable inputs for page numbers and text. The variable page number input will navigate users to the specified page within the PDF. The configured text input will be populated into the search bar, and a keyword search will be executed against that term. Even without configuring the widget, you can still manually enter any search term in the PDF view. To begin configuring annotations on the PDF document, select the Enable annotation option and refer to the Configure annotations section.

Choose a media source from the top of the configuration page to add a PDF to the widget.

The configuration panel for a newly created PDF Viewer widget.

  • Configure PDF sourcing options:
  • Select the desired media source to populate the widget with a PDF. The dropdown will provide a list of supported media sources available to you. Currently supported media sources are Compass, datasets, media references, and attachments. Once the media source is selected, configuration for that media source will be available. Example media sources may include:

    • Compass: Uses the Palantir file system as a media source for PDFs. When selecting this option, provide the following:
    • Blobster RID: A string variable to specify the Blobster RID for the desired PDF.
    • Dataset: Uses a dataset as a media source for PDFs. When selecting this option, provide the following:
    • Dataset RID: A string variable to specify the RID of the dataset that contains the desired PDF.
    • File Path: A string variable to specify the file path within the dataset of the desired PDF.
    • Branch: A string variable to specify the branchID for the dataset. If no branch is specified, this will default to the master branch.
    • Media reference: Define an object set with a single object and select the media reference typed property for the PDF.
    • Object set with a single object: An object set variable for the desired PDF. The object set selected must contain a single object.
    • Property: The desired media reference typed property from the selected object set for the desired PDF.
    • Attachments: Define an object set with a single object and select the attachment property as a media source for PDFs. When selecting this option, provide the following:
    • Object set with a single object: An object set variable for the desired PDF. The object set selected must contain a single object.
    • Property: The desired attachment property from the selected object set for the desired PDF.
  • Configure input variables:

  • Customize page number: Toggle to enable/disable using a numeric variable to capture the page number a user is currently on and/or change the current page being displayed by the widget.
  • Customize initial search: Toggle to enable/disable using a string variable to prepopulate the keyword used to search within the widget.

  • Configure annotations:

  • Display existing annotations: A single annotation object set may be configured per layer. To enable annotations, at least one layer must be added and configured. Each layer has the following configurable fields:
    • Annotation layer name: Sets the name for the annotation layer. Note that this name field is only displayed within the widget's configuration panel.
    • Object set: Input the annotation object set to be displayed within the layer.
    • Page property: Select the integer object property specifying which page of the PDF the annotation object is on.
    • Bounding box(es) property: Select the string array object property specifying the coordinates of the bounding box(es) of the annotation object. Each string element in the array should be a stringified JSON object representing the top left (x1, y1) and bottom right (x2, y2) corners of the bounding box.
    • An array is required because annotations can have multiple bounding boxes. For example, three lines of text would require three bounding boxes, one for each line. A valid bounding box property may look like [ "{"x1":0.0, "y1":2.5, "x2":50.0, "y2":10.1}", "{"x1":2.0, "y1":12, "x2":35.0, "y2":14.2}" ].
    • Selected annotations: Select an object set to use both as the input for what annotation objects should be initially selected and as the output containing the currently selected annotation(s) on the document.
    • On select event: Configure Workshop events to trigger on selection of an annotation.
    • Properties to display in tooltip: Add properties to be displayed in the tooltip popover when an annotation in this layer is selected.
    • Edit or delete existing annotations (via Actions): Configure annotation layer Actions that appear in the tooltip popover of annotation objects.
    • Action icon: Choose an icon to represent this action in the popover. If no icon is set, a pencil icon will be used by default.
    • Action label: Set the display name for the action that will display on hover for action icons in the popover and the action form header.
    • Action on annotation: Set an action that can be triggered from the popover. The hovered object may be referenced using the Hovered object variable. For more information on actions, review our action type documentation.
    • Highlight color:
    • Static: Set a static color to be used for the display of all annotations within the layer.
    • Color property: Set a string object property specifying the highlight coloring for annotations within the layer. The string property must be formatted as a color hex code (for example, "#FBD065"). If the string property does not contain a valid hex code, then the highlight coloring will default to GOLD5 (#FBD065).
    • Custom rules: Specify conditional formatting rules to dictate the highlight coloring for annotations within the layer. If no configured conditional formatting rules are met, the color highlighting for an annotation will default to GOLD5 (#FBD065).
  • Create annotations (via Actions or events): Configure Actions or events to run on new text and/or area selections.
    • Action or event icon: Choose an icon that will represent this action in the action popover when a new selection is made.
    • Action or event label: This label will show as a tooltip when hovering over an action in the action popover. If no icon is set for this action, this label will be displayed in the action popover.
    • Use for selection type: Specify whether this action should show up in the action popover for text selections, area selections, or both.
    • Action or event: Set an action or event that can be triggered from the action popover.
    • When configuring action parameters, data from the current text or area selection may be referenced using special parameter values:
      • Page number: The page number of the document of the current text or area selection. This option may be selected for integer parameters.
      • Selection coordinates: The array of strings representing the bounding box(es) of the current text or area selection. This option may be selected for string array parameters.
      • Highlighted text: The string content of the selection for text selections. Note that for area selections, the value will be an empty string. This option may be selected for string parameters.
  • Scroll to an annotation: Toggle to enable/disable automatically scrolling to an object in the annotation object set. This enables automatic scrolling to the annotations of your choice.

  • Configure more options:

  • Output user selected text: Toggle to enable/disable capturing a user’s text selections in a string variable as output from the widget.
  • Output user selected coordinates: Toggle to enable/disable capturing a user's selection coordinates in a string array variable as output from the widget.
  • Output user selected page number: Toggle to enable/disable capturing the page number that a user has made a selection on in a numeric variable as output from the widget.
  • Enable PDF downloads: Toggle to enable/disable a user's ability to download the PDF displayed in the widget.

:::callout{theme="neutral"} When annotation layers are configured, exporting a PDF with annotations can only be done via the built-in download functionality in the PDF Viewer widget. Triggering an annotation-inclusive PDF export from a separate custom button outside of the widget is not supported. :::


中文翻译

PDF 查看器

PDF 查看器微件 (Widget) 支持多种基础功能,如带文本高亮的关键词搜索及匹配项自动滚动,同时也支持显示、创建文本与区域注释 (Annotation) 并与之交互等高级功能,从而赋能用户标记工作流。

PDF Viewer

PDF Viewer with annotations.

该功能提供了许多增强功能,包括但不限于以下内容:

  • 接受字符串变量以在整个文档中进行关键词匹配。
  • 内置搜索功能,用于匹配用户提供的关键词。
  • 匹配项高亮显示(当前匹配项为绿色;其他匹配项为紫色)并显示命中次数。
  • 快速定位到首个结果并在其他命中项之间跳转。
  • 支持 MediaReferences(媒体集)
  • 显示现有注释对象。
  • 通过配置的操作 (Action) 创建注释。
  • 可自定义注释交互,包括选择时触发事件、属性显示工具提示以及自定义颜色高亮。

配置选项

微件配置支持多种媒体输入源,以及页码和文本的变量输入。页码变量输入将引导用户跳转到 PDF 中的指定页面。配置的文本输入将填充到搜索栏中,并针对该词执行关键词搜索。即使不配置微件,您仍然可以在 PDF 视图中手动输入任何搜索词。要开始配置 PDF 文档上的注释,请选择启用注释选项并参考配置注释部分。

Choose a media source from the top of the configuration page to add a PDF to the widget.

The configuration panel for a newly created PDF Viewer widget.

  • 配置 PDF 来源选项:
  • 选择所需的媒体源以将 PDF 填充到微件中。下拉菜单将提供您可用的受支持媒体源列表。当前支持的媒体源包括 Compass、数据集 (Dataset)、媒体引用 (Media reference) 和附件。选择媒体源后,即可进行该媒体源的配置。媒体源示例包括:

    • Compass: 使用 Palantir 文件系统作为 PDF 的媒体源。选择此选项时,请提供以下内容:
    • Blobster RID: 一个字符串变量,用于指定所需 PDF 的 Blobster RID。
    • 数据集 (Dataset): 使用数据集作为 PDF 的媒体源。选择此选项时,请提供以下内容:
    • Dataset RID: 一个字符串变量,用于指定包含所需 PDF 的数据集的 RID。
    • File Path: 一个字符串变量,用于指定所需 PDF 在数据集中的文件路径。
    • Branch: 一个字符串变量,用于指定数据集的 branchID。如果未指定分支,则默认为 master 分支。
    • 媒体引用 (Media reference): 定义一个包含单个对象的对象集 (Object set),并为 PDF 选择媒体引用类型的属性。
    • 包含单个对象的对象集: 所需 PDF 的对象集变量。所选对象集必须包含单个对象。
    • Property: 所选对象集中用于所需 PDF 的目标媒体引用类型属性。
    • 附件 (Attachments): 定义一个包含单个对象的对象集,并选择附件属性作为 PDF 的媒体源。选择此选项时,请提供以下内容:
    • 包含单个对象的对象集: 所需 PDF 的对象集变量。所选对象集必须包含单个对象。
    • Property: 所选对象集中用于所需 PDF 的目标附件属性。
  • 配置输入变量:

  • 自定义页码: 切换以启用/禁用使用数值变量来捕获用户当前所在的页码和/或更改微件当前显示的页面。
  • 自定义初始搜索: 切换以启用/禁用使用字符串变量来预填充在微件内搜索所用的关键词。

  • 配置注释:

  • 显示现有注释: 每个图层可配置一个注释对象集。要启用注释,必须至少添加并配置一个图层。每个图层具有以下可配置字段:
    • 注释图层名称: 设置注释图层的名称。请注意,此名称字段仅在微件的配置面板中显示。
    • 对象集 (Object set): 输入要在该图层中显示的注释对象集。
    • 页码属性: 选择整数类型的对象属性,用于指定注释对象所在的 PDF 页码。
    • 边界框 (Bounding box) 属性: 选择字符串数组类型的对象属性,用于指定注释对象的边界框坐标。数组中的每个字符串元素应为一个字符串化的 JSON 对象,表示边界框的左上角 (x1, y1) 和右下角 (x2, y2)。
    • 必须使用数组,因为注释可以包含多个边界框。例如,三行文本需要三个边界框,每行一个。有效的边界框属性可能如下所示:[ "{"x1":0.0, "y1":2.5, "x2":50.0, "y2":10.1}", "{"x1":2.0, "y1":12, "x2":35.0, "y2":14.2}" ]。
    • 选定的注释: 选择一个对象集,既用作初始应选中的注释对象的输入,也用作包含文档上当前选中的注释的输出。
    • 选择时事件: 配置在选择注释时触发的 Workshop 事件。
    • 工具提示中显示的属性: 添加在选中此图层中的注释时,要在工具提示弹出窗口中显示的属性。
    • 编辑或删除现有注释(通过操作 (Action)): 配置注释图层操作,这些操作将显示在注释对象的工具提示弹出窗口中。
    • 操作图标: 选择一个图标以在弹出窗口中表示此操作。如果未设置图标,则默认使用铅笔图标。
    • 操作标签: 设置操作的显示名称,当鼠标悬停在弹出窗口中的操作图标上以及操作表单标题中时将显示该名称。
    • 对注释执行操作: 设置可从弹出窗口触发的操作。可以使用 Hovered object 变量引用悬停的对象。有关操作的更多信息,请参阅我们的操作类型文档
    • 高亮颜色:
    • 静态: 设置一个静态颜色,用于该图层中所有注释的显示。
    • 颜色属性: 设置一个字符串类型的对象属性,用于指定该图层中注释的高亮颜色。字符串属性必须格式化为颜色十六进制代码(例如 "#FBD065")。如果字符串属性不包含有效的十六进制代码,则高亮颜色将默认为 GOLD5 (#FBD065)。
    • 自定义规则: 指定条件格式规则,以决定该图层中注释的高亮颜色。如果不满足任何配置的条件格式规则,注释的高亮颜色将默认为 GOLD5 (#FBD065)。
  • 创建注释(通过操作或事件): 配置在对新文本和/或区域进行选择时运行的操作或事件。
    • 操作或事件图标: 选择一个图标,在做出新选择时,该图标将在操作弹出窗口中表示此操作。
    • 操作或事件标签: 当鼠标悬停在操作弹出窗口中的操作上时,此标签将作为工具提示显示。如果未为此操作设置图标,则此标签将显示在操作弹出窗口中。
    • 用于选择类型: 指定此操作是否应出现在文本选择、区域选择或两者的操作弹出窗口中。
    • 操作或事件: 设置可从操作弹出窗口触发的操作或事件。
    • 配置操作参数时,可以使用特殊参数值引用当前文本或区域选择的数据:
      • 页码: 当前文本或区域选择所在文档的页码。此选项可用于整数参数。
      • 选择坐标: 表示当前文本或区域选择的边界框的字符串数组。此选项可用于字符串数组参数。
      • 高亮文本: 文本选择的字符串内容。请注意,对于区域选择,该值将为空字符串。此选项可用于字符串参数。
  • 滚动到注释: 切换以启用/禁用自动滚动到注释对象集中的对象。这使您能够自动滚动到所选的注释。

  • 配置更多选项:

  • 输出用户选择的文本: 切换以启用/禁用将用户选择的文本捕获到字符串变量中作为微件的输出。
  • 输出用户选择的坐标: 切换以启用/禁用将用户选择的坐标捕获到字符串数组变量中作为微件的输出。
  • 输出用户选择的页码: 切换以启用/禁用将用户进行选择所在的页码捕获到数值变量中作为微件的输出。
  • 启用 PDF 下载: 切换以启用/禁用用户下载微件中显示的 PDF 的功能。

:::callout{theme="neutral"} 配置注释图层后,导出包含注释的 PDF 只能通过 PDF 查看器微件中的内置下载功能来完成。不支持通过微件外部的独立自定义按钮触发包含注释的 PDF 导出。 :::