import type { StyleProp, ViewStyle } from 'react-native'; import type { PdfCapabilities, PdfMetadata, PdfOpenDocumentResult, PdfPageInfo, PdfRenderedPage, PdfRenderOptions, PdfSearchBounds, PdfSearchOptions, PdfSearchResult, } from './NativePdfApi'; /** A PDF source: a URI string, or an object with optional auth/cache control. */ export type TypePdfSource = | string | { uri: string; headers?: Record; cacheKey?: string; fileName?: string; }; export interface PdfPageChangeEvent { currentPage: number; pageCount: number; } export interface PdfErrorEvent { code: string; message: string; } export interface PdfViewerSearchHighlight { requestId: number; pageIndex?: number; bounds?: PdfSearchBounds[]; focusBounds?: PdfSearchBounds[]; } export type IPdfCapabilities = PdfCapabilities; export type IPdfMetadata = PdfMetadata; export type IPdfPageInfo = PdfPageInfo; export type IPdfRenderOptions = Omit & { format?: 'png' | 'jpeg'; }; export type IPdfRenderedPage = PdfRenderedPage; export type IPdfSearchOptions = PdfSearchOptions; export type IPdfSearchBounds = PdfSearchBounds; export type IPdfSearchResult = PdfSearchResult; export type IPdfViewerSearchHighlight = PdfViewerSearchHighlight; export type INativeOpenDocumentResult = PdfOpenDocumentResult; export type IPdfPageChangeEvent = PdfPageChangeEvent; export type IPdfErrorEvent = PdfErrorEvent; export interface IPreparedPdfSource { uri: string; fromCache: boolean; } export interface IPdfDocument { readonly documentId: string; readonly pageCount: number; readonly sourceUri: string; readonly capabilities: IPdfCapabilities; getMetadataAsync(): Promise; getPageInfoAsync(pageIndex: number): Promise; renderPageAsync( pageIndex: number, options?: IPdfRenderOptions ): Promise; getThumbnailAsync( pageIndex: number, options?: IPdfRenderOptions ): Promise; getTextAsync(pageIndex?: number): Promise; searchTextAsync( query: string, options?: IPdfSearchOptions ): Promise; closeAsync(): Promise; } export interface IPdfViewRef { openDocumentAsync(): Promise; getTextAsync(pageIndex?: number): Promise; searchTextAsync( query: string, options?: IPdfSearchOptions ): Promise; clearSearchAsync(): void; closeDocumentAsync(): Promise; } export interface IPdfViewProps { source: TypePdfSource; backgroundColor?: string; initialPage?: number; pageSpacing?: number; maxZoom?: number; maxPageResolution?: number; singlePage?: boolean; style?: StyleProp; onLoad?: (event: { nativeEvent: INativeOpenDocumentResult }) => void; onPageChange?: (event: { nativeEvent: IPdfPageChangeEvent }) => void; onError?: (event: { nativeEvent: IPdfErrorEvent }) => void; }