Package-level declarations

Types

Link copied to clipboard
class ComposePrintAdapter(activity: ComponentActivity, documentName: String, pageModifier: Modifier = Modifier, pageDpi: Int = DefaultPageDpi, printBreakpoints: Boolean = false, mainContext: CoroutineContext = Dispatchers.Main, ioDispatcher: CoroutineDispatcher = Dispatchers.IO, content: @Composable () -> Unit) : CoroutinePrintDocumentAdapter

A PrintDocumentAdapter that prints a composable function. The composable content is paginated as best-effort to avoid cutting off composables in the middle (see Paged).

Link copied to clipboard

A PrintDocumentAdapter that exposes onLayout and onWrite functions as suspend functions that will automatically invoke the correct callback methods.

Link copied to clipboard
data class PageBreakpoint(val xAnchorPx: Pair<Int, Int>, val yPx: Int, val forceBreak: Boolean)

Represents a point in a composition where it is safe to break the page.

Link copied to clipboard

After the first frame of a Paged is committed, the breakpoints and page offsets are calculated and passed to a callback via an instance of this interface.

Link copied to clipboard
abstract class PrintableController

Provides the print method to trigger printing Printable composables. Create one by calling rememberPrintableController.

Functions

Link copied to clipboard

Returns a Modifier that will hide the composable it's applied to when printing.

Link copied to clipboard

Returns a Modifier that will prevent Paged from putting a page break between this composable and the next.

Link copied to clipboard
fun Paged(modifier: Modifier = Modifier, pageIndex: Int = 0, pageModifier: Modifier = Modifier, clipLastBreakpoint: Boolean = true, drawBreakpoints: Boolean = false, onPageLayout: (pageCount: Int) -> Unit? = null, content: @Composable () -> Unit)

Divides a composable into discreet pages. The content is measured with unbounded height, and then displayed using the current constraints, starting at pageIndex (the content is translated up). The bottom of the content is clipped, but a best-effort attempt is made to not cut any individual composables off in the middle. When the initial "pagination" measurement is complete, onPageLayout is invoked with the total page count.

Link copied to clipboard
fun Printable(controller: PrintableController, modifier: Modifier = Modifier, pageDpi: Int = DefaultPageDpi, printBreakpoints: Boolean = false, content: @Composable () -> Unit)

Renders content as-is, and will allow the content to be printed with PrintableController. To start a print job, call PrintableController.print.

Link copied to clipboard

Creates and remembers a PrintableController that can be passed to Printable to start print jobs.

Link copied to clipboard
fun Modifier.responsivePadding(vararg minDimensionsToPadding: Pair<Dp, Dp>): Modifier

A Modifier that adds different padding depending on the minimum dimension of the max constraints.

Properties

Link copied to clipboard
const val DefaultPageDpi: Int = 100
Link copied to clipboard

Returns true if a Printable is being used to print the composition somewhere up in the tree.