PdfErrorCode
このコンテンツはまだ日本語訳がありません。
PdfErrorCode =
"INVALID_INPUT"|"FILE_NOT_FOUND"|"INVALID_PDF"|"PASSWORD_REQUIRED"|"INVALID_PASSWORD"|"INVALID_PAGE_NUMBER"|"RENDER_FAILED"|"DOCUMENT_CLOSED"|"MISSING_FONT"|"MISSING_GLYPHS"|"UNKNOWN"
Defined in: packages/core/src/types.ts:474
Error codes for PDF operations.
Each code identifies a specific type of error:
| Code | Description |
|---|---|
INVALID_INPUT | Input is not a valid file path, Buffer, Uint8Array, or ArrayBuffer |
FILE_NOT_FOUND | The specified file path does not exist |
INVALID_PDF | The input data is not a valid PDF file |
PASSWORD_REQUIRED | The PDF is encrypted and requires a password |
INVALID_PASSWORD | The provided password is incorrect |
INVALID_PAGE_NUMBER | The page number is out of range (less than 1 or greater than pageCount) |
RENDER_FAILED | Failed to render a page to an image |
DOCUMENT_CLOSED | Attempted to use a document after it was closed |
MISSING_FONT | Font is not embedded and cannot be rendered correctly |
UNKNOWN | An unexpected error occurred |
Example
import { PdfError, type PdfErrorCode } from 'noto-pdf-ts'
function handleError(code: PdfErrorCode): string { switch (code) { case 'PASSWORD_REQUIRED': return 'Please provide a password' case 'INVALID_PASSWORD': return 'Wrong password' case 'FILE_NOT_FOUND': return 'File not found' default: return 'An error occurred' }}