Appearance
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
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
apiBaseUrl | api-base-url | Base URL of the Pdf Api server, for usage with an on-premise Api. | string | undefined | undefined |
privatekey | privatekey | Private Key used to start a Session on the Pdf Api server. | string | undefined | undefined |
publickey | publickey | Public Key used to start a Session on the Pdf Api server. | string | undefined | undefined |
sessionsurl | sessionsurl | URL that points to the backend service that acquires a jwt for authentication (defaults to '/api/sessions'). | string | undefined | undefined |
Events
Event | Description | Type |
---|---|---|
apiError | Event handler used to report Api errors. | CustomEvent<HttpError> |
Methods
createDocument(source: string | null, operations: any[], fileName?: string) => Promise<null | IPdfDocument>
Create new document
Parameters
Name | Type | Description |
---|---|---|
source | string | null | |
operations | any[] | |
fileName | string | undefined |
Returns
Type: Promise<IPdfDocument | null>
deleteDocument(id: string) => Promise<void>
Delete single document with given ID
Parameters
Name | Type | Description |
---|---|---|
id | string |
Returns
Type: Promise<void>
deleteDocuments(ids: string[]) => Promise<void>
Delete multiple documents with given IDs
Parameters
Name | Type | Description |
---|---|---|
ids | string[] |
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