Skip to content

Overview

The pdf-application component is a bridge between the browser and the server-side PDF Viewer API. It manages a session with the API, handles secure communication and authentication, and provides application-level services.

Key Features:

  • Manages secure communication with the server-side PDF Viewer API.
  • Provides authentication.
  • Offers application-level services such as obtaining a list of all uploaded files and controlling storage functions (e.g., deleting files).

To use any other component, a pdf-application component must be instantiated first. One session can be used for any number of PDF documents.

The <pdf-application> element can wrap other components, but this is not required. It has no HTML content and is invisible.

Usage

Sample usage:

html
<pdf-application privatekey="myprivatekey" publickey="mypublickey" />

For security reasons, it's recommended to use it with a server. If used without a server by providing a public and private key, the security could be compromised.

If no keys are provided, the component expects an endpoint on the current host with url /api/sessions to start a session. This endpoint can add the keys and fetch a session token from the PDF API.

See Authentication for more information.

Properties

PropertyAttributeDescriptionTypeDefault
apiBaseUrlapi-base-urlBase URL of the Pdf Api server, for usage with an on-premise Api.string | undefinedundefined
privatekeyprivatekeyPrivate Key used to start a Session on the Pdf Api server.string | undefinedundefined
publickeypublickeyPublic Key used to start a Session on the Pdf Api server.string | undefinedundefined
sessionsurlsessionsurlURL that points to the backend service that acquires a jwt for authentication (defaults to '/api/sessions').string | undefinedundefined

Events

EventDescriptionType
apiErrorEvent handler used to report Api errors.CustomEvent<HttpError>

Methods

createDocument(source: string | null, operations: any[], fileName?: string) => Promise<null | IPdfDocument>

Create new document

Parameters

NameTypeDescription
sourcestring | null
operationsany[]
fileNamestring | undefined

Returns

Type: Promise<IPdfDocument | null>

deleteDocument(id: string) => Promise<void>

Delete single document with given ID

Parameters

NameTypeDescription
idstring

Returns

Type: Promise<void>

deleteDocuments(ids: string[]) => Promise<void>

Delete multiple documents with given IDs

Parameters

NameTypeDescription
idsstring[]

Returns

Type: Promise<void>

getAbout() => Promise<IAbout>

Get diagnostics

Returns

Type: Promise<IAbout>

getDocuments() => Promise<IPdfDocument[]>

Retrieve list of documents

Returns

Type: Promise<IPdfDocument[]>


Built with StencilJS