Skip to content
React PDF Viewer

Search

PdfRequestOptions 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

NameTypeDefaultRequiredDescription
requestInitRequestInit—NoExtra fetch options for URL sources: headers, credentials, mode, …
fetcher(url: string, init: RequestInit) => Promise<Response>—NoReplaces fetch entirely, e.g. with an authenticated HTTP client.
onHttpError(response: Response) => boolean | void | Promise<boolean | void>—NoCalled 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>—NoBuilds 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.