Type Alias: ViewerConfig
ViewerConfig =
object
Represents the configuration options for initializing the PDF viewer.
Properties
accessibilityLayerEnabled?
optionalaccessibilityLayerEnabled:boolean
Whether to enable the accessibility layer. This improves accessibility for users with disabilities.
customCssVars?
optionalcustomCssVars:Record<CssVar,string>
Custom CSS variables to apply to the viewer. This allows for theming and styling of the viewer components.
The keys should be valid CSS variable names (e.g., --primary-color) and the values should be valid CSS values (e.g., #ff0000 or 16px).
customLocalisationFile?
optionalcustomLocalisationFile:string
Custom localisation file URL. If provided, the viewer will load the localisation data from this file instead of using the default translations.
The file should be in JSON format and follow the structure of the default localisation files.
devicePixelRatio?
optionaldevicePixelRatio:number
The device pixel ratio (DPR) setting for rendering the PDF. Higher values result in better quality but may impact performance.
inputDocument?
An optional input document to open in the viewer upon initialization. This can be either a file or a URI. If provided, the viewer will automatically load and display this document when it is initialized.
lang?
optionallang:"en"|"de"
The language to use in the viewer. Supported values are en for English and de for German.
If not specified, the viewer will default to English.
licenseKey?
optionallicenseKey:LicenseKey
License key for the PDF viewer. This is required for the viewer to function properly. You can obtain a license key from the PDF Tools website. If you are using a trial version of the viewer, you can use the staging license key provided in the documentation, but keep in mind that it will add a watermark to the documents.
licenseUrl?
optionallicenseUrl:string
URL to fetch the license key from. This is required if you are using a license key that needs to be fetched from a server. The viewer will request this URL to retrieve the license key during initialization.
path?
optionalpath:string
Path to the worker script. This is required for the viewer to function properly, as it uses a web worker for rendering and processing PDF documents.
producerSuffix?
optionalproducerSuffix:string
Suffix to append to the producer string in the PDF metadata.
user?
optionaluser:string
An optional user identifier to associate with the viewer session. If not specified, the viewer will use a default user identifier.
zoomLevels?
optionalzoomLevels:number[]
Custom zoom levels for the viewer. This allows you to specify the zoom levels that will be available in the viewer’s zoom dropdown.
The values should be numbers representing the zoom percentage (e.g., 1 for 100% zoom, 1.5 for 150% zoom, 0.25 for 25% zoom).
If not specified, the viewer will use default zoom levels.