Pdf Request Options reference
Controls how string and URL sources are fetched: extra fetch options, a replacement fetcher and the handling of HTTP errors.
Used by
Import
import type { PdfRequestOptions } from '@kingtech/react-pdf-viewer';Properties
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
requestInit | RequestInit | — | No | Extra fetch options for URL sources: headers, credentials, mode, … |
fetcher | (url: string, init: RequestInit) => Promise<Response> | — | No | Replaces fetch entirely, e.g. with an authenticated HTTP client. |
onHttpError | (response: Response) => boolean | void | Promise<boolean | void> | — | No | Called for non-2xx responses. Return true when handled (e.g. after redirecting to sign-in): the viewer shows its empty state and does not call onError. |
getHttpErrorMessage | (response: Response) => Promise<string> | — | No | Builds the HTTP_ERROR message. Return undefined for the default: an RFC 7807 detail, then title, then a JSON string body, then Failed to fetch PDF: {status} {statusText}. |
Source
packages/react-pdf-viewer/src/types.ts
Generated from content/react-pdf-viewer/reference/pdf-request-options.schema.json. Do not edit by hand.