Skip to content
React PDF Viewer

Search

PdfViewerErrorCode reference

Machine-readable category of a PdfViewerError, for handling failures such as a missing password or an HTTP error in code.

Used by

Import

import type { PdfViewerErrorCode } from '@kingtech/react-pdf-viewer';

Signature: type PdfViewerErrorCode = 'PDFJS_LOAD_FAILED' | 'NETWORK_ERROR' | 'HTTP_ERROR' | 'INVALID_PDF' | 'PASSWORD_REQUIRED' | 'INCORRECT_PASSWORD' | 'RENDER_FAILED' | 'DOWNLOAD_FAILED' | 'PRINT_FAILED' | 'UNKNOWN'

Properties

NameTypeDefaultRequiredDescription
PDFJS_LOAD_FAILED'PDFJS_LOAD_FAILED'—NoThe pdfjs-dist module or its worker failed to load.
NETWORK_ERROR'NETWORK_ERROR'—Nofetch rejected: offline, CORS, DNS, …
HTTP_ERROR'HTTP_ERROR'—NoThe server answered with a non-2xx status (status is set).
INVALID_PDF'INVALID_PDF'—NoThe bytes are not a valid PDF.
PASSWORD_REQUIRED'PASSWORD_REQUIRED'—NoThe document is encrypted and no password was supplied.
INCORRECT_PASSWORD'INCORRECT_PASSWORD'—NoThe supplied password is wrong.
RENDER_FAILED'RENDER_FAILED'—NoA page failed to render.
DOWNLOAD_FAILED'DOWNLOAD_FAILED'—NoSaving the document failed.
PRINT_FAILED'PRINT_FAILED'—NoPrinting failed.
UNKNOWN'UNKNOWN'—NoAnything else.

Source

packages/react-pdf-viewer/src/types.ts

Generated from content/react-pdf-viewer/reference/pdf-viewer-error-code.schema.json. Do not edit by hand.