Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
Is there any way to convert Composables into Pdf file?

I want to allow users to download the ticket from the app in PDF format and store it locally. I want to have exactly similar view in PDF format, that's why I am searching for way to convert composables to PDF. It will be cool to directly convert compose view into Pdf format. Is this possible to achieve?

1.) KotOrderTicket.kt

@Composable
fun KotOrderTicket(modifier: Modifier = Modifier) {
    var totalQuantity: Int = 0

    val rowModifier = Modifier
        .fillMaxWidth()

    val textCenterModifier = Modifier
        .fillMaxWidth()
        .wrapContentWidth(align = Alignment.CenterHorizontally)

    LazyColumn(
        modifier = modifier
            .fillMaxWidth(),
    ){
        item {
            KotDashedDivider()
            Text("Kitchen Order Ticket - Dinning", modifier = textCenterModifier)
            KotDashedDivider()
            Text("Running", modifier = textCenterModifier)
            KotDashedDivider()

            Row(
                modifier = rowModifier,
                horizontalArrangement = Arrangement.SpaceBetween,
            ){
                Text("Kot# 22")
                Text("Table T7")
            }
            Text("Date 2022-04-3 10: 23: 22")
            Text("Ready Till 2022-04-3 10: 23: 22")
            KotDashedDivider()

            Row(
                modifier = rowModifier,
                horizontalArrangement = Arrangement.SpaceBetween,
            ){
                Text("SN")
                Text("Item's Name")
                Text("Qty")
            }
            KotDashedDivider()
        }

        itemsIndexed(summaryItems) { index, item ->
            totalQuantity += (item.qty?.toInt() ?: 0)
            KotItemSummary(sn = index.toString(), name = item.productId.toString(), qty = item.qty.toString(), comment = "\"Nun kam rakhnu hai\"")
        }

        item {
            KotDashedDivider()
            Row(
                modifier = rowModifier,
                horizontalArrangement = Arrangement.SpaceBetween,
            ){
                Text("")
                Text("Total Qty: ")
                Text(totalQuantity.toString())
            }
            KotSpacer()
            Text("Remarks: ")
            Text("\"Please cook fast, i am so hungry\"")
        }
    }
}

2.) This view will look like this.

How to convert composeables into pdf format and save it.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda