Configuration

TypeScript

Dukungan TypeScript dan definisi tipe.

Nuxt PDF Kit menyediakan dukungan penuh untuk TypeScript.

Mengimpor Tipe

import type {
  ToolbarOptions,
  ZoomLevel,
  ViewMode,
  ScrollMode,
  SearchMatch,
  DocumentProperties,
  PdfViewerControls,
} from 'nuxt-pdf-kit'

Definisi Tipe

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
}

Contoh Penggunaan

import type { ToolbarOptions, ZoomLevel } from 'nuxt-pdf-kit'

const toolbarConfig: ToolbarOptions = {
  sidebar: true,
  pageNavigation: true,
  zoom: true,
  search: true,
}

const currentZoom: ZoomLevel = 'page-fit'
Copyright © 2026