PdfRequest

data class PdfRequest(val source: DocumentSource, val pageNumbers: List<Int>? = null, val enableSwipe: Boolean = true, val enableDoubleTap: Boolean = true, val defaultPage: Int = 0, val swipeHorizontal: Boolean = false, val annotationRendering: Boolean = false, val password: String? = null, val scrollHandle: ScrollHandle? = null, val antialiasing: Boolean = true, val spacing: Float = 0.0f, val autoSpacing: Boolean = false, val pageFitPolicy: FitPolicy = FitPolicy.WIDTH, val fitEachPage: Boolean = false, val pageFling: Boolean = false, val pageSnap: Boolean = false, val scrollOptimization: Boolean = true, val nightMode: Boolean = false, val disableLongPress: Boolean = false, val pdfViewerConfiguration: PdfViewerConfiguration = PdfViewerConfiguration.DEFAULT, val documentLoadListener: DocumentLoadListener? = null, val renderingEventListener: RenderingEventListener? = null, val pageNavigationEventListener: PageNavigationEventListener? = null, val gestureEventListener: GestureEventListener? = null, val linkHandler: LinkHandler? = null, val logWriter: LogWriter? = null)

Represents a configuration request for loading and rendering a PDF document.

This class encapsulates all the settings and options that can be applied when loading and displaying a PDF. It's used to customize the behavior of the PDF viewer, such as enabling/disabling features, setting the initial page, defining the page fit policy, and more.

Constructors

Link copied to clipboard
constructor(source: DocumentSource, pageNumbers: List<Int>? = null, enableSwipe: Boolean = true, enableDoubleTap: Boolean = true, defaultPage: Int = 0, swipeHorizontal: Boolean = false, annotationRendering: Boolean = false, password: String? = null, scrollHandle: ScrollHandle? = null, antialiasing: Boolean = true, spacing: Float = 0.0f, autoSpacing: Boolean = false, pageFitPolicy: FitPolicy = FitPolicy.WIDTH, fitEachPage: Boolean = false, pageFling: Boolean = false, pageSnap: Boolean = false, scrollOptimization: Boolean = true, nightMode: Boolean = false, disableLongPress: Boolean = false, pdfViewerConfiguration: PdfViewerConfiguration = PdfViewerConfiguration.DEFAULT, documentLoadListener: DocumentLoadListener? = null, renderingEventListener: RenderingEventListener? = null, pageNavigationEventListener: PageNavigationEventListener? = null, gestureEventListener: GestureEventListener? = null, linkHandler: LinkHandler? = null, logWriter: LogWriter? = null)

Types

Link copied to clipboard
class Builder(source: DocumentSource)

Properties

Link copied to clipboard

Enables or disables rendering of PDF annotations. Defaults to false.

Link copied to clipboard
val antialiasing: Boolean = true

Enables or disables anti-aliasing for smoother rendering. Defaults to true.

Link copied to clipboard
val autoSpacing: Boolean = false

If true, automatically adjusts spacing between pages based on screen size. Defaults to false.

Link copied to clipboard
val defaultPage: Int = 0

The initial page number to display when the document is loaded. Defaults to 0 (the first page).

Link copied to clipboard

Disables long press gestures on the PDF view. Defaults to false.

Link copied to clipboard

A listener to be notified when the document is loaded and ready for rendering. Defaults to null.

Link copied to clipboard

Enables or disables double tap gestures for zooming. Defaults to true.

Link copied to clipboard
val enableSwipe: Boolean = true

Enables or disables swipe gestures for page navigation. Defaults to true.

Link copied to clipboard
val fitEachPage: Boolean = false

If true, each page will be individually fitted to the screen. Defaults to false.

Link copied to clipboard

A listener to be notified of gesture events (e.g., when a gesture is detected). Defaults to null.

Link copied to clipboard

A handler for processing link clicks in the PDF document. Defaults to null.

Link copied to clipboard
val logWriter: LogWriter? = null

A writer for logging messages and errors. Defaults to null.

Link copied to clipboard
val nightMode: Boolean = false

Enables or disables night mode, which inverts the colors for better readability in low-light conditions. Defaults to false.

Link copied to clipboard

The policy to use for fitting the page content to the screen. Defaults to FitPolicy.WIDTH.

Link copied to clipboard
val pageFling: Boolean = false

Enables or disables page flinging for faster navigation. Defaults to false.

Link copied to clipboard

A listener to be notified of page navigation events (e.g., when a page is changed). Defaults to null.

Link copied to clipboard
val pageNumbers: List<Int>? = null

An optional list of specific page numbers to load. If null, all pages are loaded.

Link copied to clipboard
val pageSnap: Boolean = false

Enables or disables page snapping, where pages will snap to the screen edges. Defaults to false.

Link copied to clipboard
val password: String? = null

The password to use if the PDF document is encrypted. Defaults to null.

Link copied to clipboard

Custom rendering options for the PDF document. Defaults to PdfViewerConfiguration.DEFAULT.

Link copied to clipboard

A listener to be notified of rendering events (e.g., when a page is rendered). Defaults to null.

Link copied to clipboard

The type of scroll handle to display. Defaults to null (no scroll handle).

Link copied to clipboard

Enables or disables scroll optimization. When true, bitmap generation is skipped during scrolling for better performance, but may show empty areas when scrolling to new content. Defaults to true.

Link copied to clipboard

The source of the PDF document to load (e.g., file, asset, URI).

Link copied to clipboard
val spacing: Float = 0.0f

The spacing between pages in pixels. Defaults to 0F.

Link copied to clipboard

If true, swipe gestures will navigate horizontally instead of vertically. Defaults to false.

Functions

Link copied to clipboard
open override fun toString(): String