コンテンツにスキップ

PdfInput

このコンテンツはまだ日本語訳がありません。

PdfInput = string | Buffer | Uint8Array | ArrayBuffer

Defined in: packages/core/src/types.ts:33

Input types that can be used to open a PDF document.

Supported input types:

  • string - File path to a PDF file
  • Buffer - Node.js Buffer containing PDF data
  • Uint8Array - Typed array containing PDF data
  • ArrayBuffer - Raw binary data containing PDF

Example

// From file path
const pdf = await openPdf('/path/to/document.pdf')
// From Buffer
const buffer = await fs.readFile('/path/to/document.pdf')
const pdf = await openPdf(buffer)
// From Uint8Array (e.g., from fetch)
const response = await fetch('https://example.com/document.pdf')
const data = new Uint8Array(await response.arrayBuffer())
const pdf = await openPdf(data)