For the complete documentation index, see llms.txt. This page is also available as Markdown.

PDF preview - PdfViewer

Availability of the functionality depends on the license and may not be available in all deployments.

The component allows displaying a PDF document directly on the form. The document can be specified using a file path available in the environment or a URL to an external resource. This allows the user to review the content (e.g. regulations, agreement, or instructions) without having to download the file to disk or open a new browser tab.

When to use:

  • Displaying a single PDF document directly on the form.

When not to use:

  • Presenting a list of documents or enabling their download. Use: DocumentList.

  • Providing the user with a link to a document or other resource without displaying its content on the form. Use: ExternalLink.

PDF viewer component

Figure 1. Example appearance of the component on the form

Component properties

Eximee Designer properties
Attribute name in Source
Description

PDF link (section Basic properties)

pdfUrl

A relative path to a file placed in a folder in the environment, or an external link, however in that case it must meet the CORS policy requirements (the Access-Control-Allow-Origin header must be set appropriately).

By default, the property is set to empty.

Important: Entering an incorrect URL or not entering one at all causes an error and prevents the application from being filled in after attempting to display the PDF file.

More information about component properties: Common component properties

Component configuration

The PDF file address should be configured in the field PDF link in the component properties panel. This value can be entered directly as a static link or passed dynamically using a variable.

  1. Path to a file available in the environment

    This involves providing a path to a static resource placed directly in the application server's directory structure.

    Figure 2. Component configuration using a local path
  2. External URL address

    This involves providing an absolute URL to the file. However, the external server must allow the browser to download the file from the application, in accordance with the CORS policy.

    Figure 3. Component configuration using an external URL address

CORS is a security mechanism in web browsers. It blocks downloading resources (e.g. PDF files) from a domain other than the one where the form is located, unless the target server explicitly allows it by sending the appropriate HTTP header (Access-Control-Allow-Origin).

  1. Filling the component with a session variable value

    The PDF file address can be dynamically filled with a session variable value. In the field PDF link you can use a reference to a variable (e.g. ${pdfUrl}), which will be filled with a value coming from a script or service.

    Figure 4. Component configuration using a session variable
    Figure 5. Session variable filled with a value from a script

When filling the component with a session variable, remember to add a listener for this variable.

Note that the session variable value cannot be empty — otherwise the application will not work properly after attempting to display the component.

Demo applications: demoPdfViewer

Last updated

Was this helpful?