compose-pdf

Displays PDF files with a multiplatform library, supporting desktop and Android. Usage involves setting up dependencies and initializing local PDF state for rendering PDF content.

Android
JVM
GitHub stars100
Authorszt64
Dependents0
LicenseMIT License
Creation dateabout 3 years ago

Last activity4 days ago
Latest release2.0.0 (3 months ago)

Compose PDF

Maven Central Version GitHub
badge-platform-jvm badge-platform-android

Compose Multiplatform library to display PDF files.

Supported platforms:

Setup

Kotlin Build script
dependencies {
    implementation("dev.zt64:compose-pdf:x.y.z")
}
Version catalog
[versions]
compose-pdf = "x.y.z"

[libraries]
compose-pdf = { module = "dev.zt64:compose-pdf", version.ref = "compose-pdf" }

Usage

// To display a PDF file, first you need a PDF state
// It can be created using the `rememberPdfState` function
// The function has several available overloads, for example, you can pass a `File` object
val pdfState = rememberPdfState(File("path/to/file.pdf"))

// Then you can use the included composables to display the PDF
// For example to display all pages in a vertical list you can use the `PdfColumn` composable
PdfColumn(pdfState)

// Or to display in a vertical list with snapping you can use the `PdfVerticalPager` composable
PdfVerticalPager(pdfState)

// And likewise for a horizontal list with snapping you can use the `PdfHorizontalPager` composable
PdfHorizontalPager(pdfState)

// You can also use the `PdfPage` composable directly to display a single page and have more control over the layout
PdfPage(pdfState, pageNumber = 0)

License

MIT

Android
JVM
GitHub stars100
Authorszt64
Dependents0
LicenseMIT License
Creation dateabout 3 years ago

Last activity4 days ago
Latest release2.0.0 (3 months ago)

Compose PDF

Maven Central Version GitHub
badge-platform-jvm badge-platform-android

Compose Multiplatform library to display PDF files.

Supported platforms:

Setup

Kotlin Build script
dependencies {
    implementation("dev.zt64:compose-pdf:x.y.z")
}
Version catalog
[versions]
compose-pdf = "x.y.z"

[libraries]
compose-pdf = { module = "dev.zt64:compose-pdf", version.ref = "compose-pdf" }

Usage

// To display a PDF file, first you need a PDF state
// It can be created using the `rememberPdfState` function
// The function has several available overloads, for example, you can pass a `File` object
val pdfState = rememberPdfState(File("path/to/file.pdf"))

// Then you can use the included composables to display the PDF
// For example to display all pages in a vertical list you can use the `PdfColumn` composable
PdfColumn(pdfState)

// Or to display in a vertical list with snapping you can use the `PdfVerticalPager` composable
PdfVerticalPager(pdfState)

// And likewise for a horizontal list with snapping you can use the `PdfHorizontalPager` composable
PdfHorizontalPager(pdfState)

// You can also use the `PdfPage` composable directly to display a single page and have more control over the layout
PdfPage(pdfState, pageNumber = 0)

License

MIT