> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markpdf.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Inicio rápido

> Tu primera conversión con Kotlin SDK en menos de 15 líneas.

# Inicio rápido

Todos los métodos del cliente son `suspend fun`: llámelos desde una corrutina (`runBlocking`, `viewModelScope`, un punto final Ktor/Spring WebFlux suspendido, etc.).

## Convertir un archivo local

```kotlin theme={null}
import kotlinx.coroutines.runBlocking
import tech.markpdf.MarkpdfClient
import tech.markpdf.ConvertOptions
import tech.markpdf.ConvertResult
import java.io.File

fun main() = runBlocking {
    val client = MarkpdfClient(apiKey = "YOUR_API_KEY")

    val result = client.convertFile(File("report.pdf"), ConvertOptions(mode = ConversionMode.FAST))

    when (result) {
        is ConvertResult.Markdown -> println(result.markdown)
        else -> {}
    }
}
```

## Convertir bytes a memoria

```kotlin theme={null}
val bytes = File("report.pdf").readBytes()
val result = client.convertBytes(bytes, "report.pdf")
```

## Convertir de URL

```kotlin theme={null}
val result = client.convertFromUrl(
    url = "https://bucket.example.com/report.pdf?sig=...",
    filename = "report.pdf",
    options = ConvertOptions(mode = ConversionMode.FAST),
)
```

## Solicitar metadatos además de Markdown

```kotlin theme={null}
val result = client.convertBytes(
    bytes, "report.pdf",
    options = ConvertOptions(responseFormat = ResponseFormat.JSON),
)

when (result) {
    is ConvertResult.Json -> {
        println(result.result.markdown)
        println(result.result.engine)
        println(result.result.timings.totalRequestMs)
    }
    else -> {}
}
```

`ConvertResult` es una clase sellada; utilice `when` exhaustivo para descomprimirla. Consulte [Referencia](/docs/public/es/sdks/kotlin/reference).

## Siguiente paso

* [Referencia completa del cliente](/docs/public/es/sdks/kotlin/reference)
* [Corrutinas y trabajos asincrónicos (202)](/docs/public/es/sdks/kotlin/streaming-and-async)
* [Manejo de errores](/docs/public/es/sdks/kotlin/error-handling)
