The index.ISetupOptions interface defines all configuration options for the PDF Web Viewer. This section provides comprehensive examples and guides for each configuration category.
Explore detailed documentation for each configuration area:
| Option | Type | Description | Required |
|---|---|---|---|
license |
string |
Your license key. | Yes |
workerPath |
string |
Path to the PDF worker script. | No |
fontsPath |
string |
Path to the fonts directory. | No |
i18nPath |
string |
Path to the i18n (translations) directory. | No |
stampsPath |
string |
Path to the stamps directory. | No |
hideToolsPanel |
boolean |
If true, hides the toolbar and sidebar (Minimal UI). |
No |
proxyUrl |
string |
URL for the proxy server. | No |
layoutConfig |
index.ILayoutConfig | Configuration for the editor layout (header, sidebar, etc.). | No |
brandingConfig |
index.IBrandingConfig | Configuration for branding (colors, logos). | No |
themeConfig |
index.IThemeConfig | Configuration for the theme (light/dark). | No |
languageConfig |
index.ILanguageConfig | Configuration for the language. | No |
defaultFont |
index.IDefaultFontConfig | Configuration for the default font. | No |
unitsAndGuides |
index.IUnitsAndGuidesConfig | Configuration for units and guides. | No |
userName |
string |
The name of the user (for annotations). | No |
container |
HTMLElement |
The DOM element where the viewer will be rendered. | No |
dialogs |
CustomDialogs |
Custom dialog implementations. | No |
onLoadingStateChange |
(isLoading: boolean) => void |
Callback for loading state changes. | No |
onError |
(error: Error) => void |
Callback for errors. | No |
onConfigChange |
(config: index.IConfigChangeData) => void |
Callback for configuration changes. | No |
onOpenFile |
() => Promise<void> |
Custom handler for opening files. | No |
onDownloadFile |
(file: File) => void |
Custom handler for downloading files. | No |
onPrint |
(file: File, newTab?: boolean) => void |
Custom handler for printing files. | No |
onPasswordRequired |
index.IPasswordRequiredCallback | Custom handler for password-protected files. | No |
userFonts |
IUserFont[] |
List of user-defined fonts. | No |
userInitial |
index.AppearanceModel[] |
User's initial appearances. | No |
userSignature |
index.AppearanceModel[] |
User's signature appearances. | No |
The simplest setup requires only a license key:
const editor = await PdfEditor({
license: 'YOUR_LICENSE_KEY',
});
Display the complete PDF editor interface:
const editor = await PdfEditor({
license: 'YOUR_LICENSE_KEY',
container: document.getElementById('pdf-container'),
});
Configure with custom branding and theme:
const editor = await PdfEditor({
license: 'YOUR_LICENSE_KEY',
container: document.getElementById('pdf-container'),
// Branding
brandingConfig: {
logo: 'https://example.com/logo.png',
colors: {
primary: '#FF6B35',
},
},
// Theme
themeConfig: {
mode: 'light',
},
// User settings
userName: 'John Doe',
languageConfig: {
code: 'en',
},
});
For detailed examples and specific use cases, explore the configuration category pages:
For complete API documentation, see index.ISetupOptions.