Configuration
TypeScript
TypeScript support and type definitions.
Nuxt PDF Kit provides full TypeScript support.
Importing Types
import type {
ToolbarOptions,
ZoomLevel,
ViewMode,
ScrollMode,
SearchMatch,
DocumentProperties,
PdfViewerControls,
} from 'nuxt-pdf-kit'
Type Definitions
ToolbarOptions
interface ToolbarOptions {
sidebar?: boolean
pageNavigation?: boolean
zoom?: boolean
search?: boolean
rotate?: boolean
openFile?: boolean
print?: boolean
download?: boolean
fullscreen?: boolean
themeToggle?: boolean
moreOptions?: boolean
}
ZoomLevel
type ZoomLevel = 'auto' | 'page-fit' | 'page-width' | number
ViewMode
type ViewMode = 'single' | 'dual' | 'dual-cover'
ScrollMode
type ScrollMode = 'vertical' | 'horizontal' | 'wrapped' | 'page'
SearchMatch
interface SearchMatch {
pageIndex: number
matchIndex: number
text: string
}
DocumentProperties
interface DocumentProperties {
title: string
author: string
subject: string
keywords: string
creator: string
producer: string
creationDate: string
modDate: string
pageCount: number
fileSize: string
pdfVersion: string
}
Usage Example
import type { ToolbarOptions, ZoomLevel } from 'nuxt-pdf-kit'
const toolbarConfig: ToolbarOptions = {
sidebar: true,
pageNavigation: true,
zoom: true,
search: true,
}
const currentZoom: ZoomLevel = 'page-fit'