<script lang="ts">
import { MarkpdfClient, createConvertStore } from "@markpdf/svelte";
const client = new MarkpdfClient({ apiKey: "YOUR_API_KEY" });
const convertStore = createConvertStore(client);
function onFile(e: Event) {
const file = (e.target as { files?: FileList | null }).files?.[0];
if (file) convertStore.convert(file, { mode: "fast" });
}
</script>
<input type="file" accept="application/pdf" on:change={onFile} />
{#if $convertStore.status === "uploading"}
<progress value={$convertStore.progress} max={100} />
{/if}
{#if $convertStore.status === "converting"}
<p>Convirtiendo…</p>
{/if}
{#if $convertStore.error}
<p>Error: {$convertStore.error.message}</p>
{/if}
{#if $convertStore.markdown}
<pre>{$convertStore.markdown}</pre>
{/if}