
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.
Compose Multiplatform library to display PDF files.
dependencies {
implementation("dev.zt64:compose-pdf:x.y.z")
}[versions]
compose-pdf = "x.y.z"
[libraries]
compose-pdf = { module = "dev.zt64:compose-pdf", version.ref = "compose-pdf" }// 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)Compose Multiplatform library to display PDF files.
dependencies {
implementation("dev.zt64:compose-pdf:x.y.z")
}[versions]
compose-pdf = "x.y.z"
[libraries]
compose-pdf = { module = "dev.zt64:compose-pdf", version.ref = "compose-pdf" }// 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)