> ## 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.

# Referencia

> createConvertStore, ConvertStore and @markpdf/svelte types.

# Referencia

## `createConvertStore(client)`

```ts theme={null}
function createConvertStore(client: MarkpdfClient): ConvertStore
```

<ParamField body="client" type="MarkpdfClient" required>
  Instance of `MarkpdfClient` (re-exported from `@markpdf/svelte`, identical to `@markpdf/sdk`).
</ParamField>

Returns `ConvertStore`: a Svelte store (`Readable<ConvertState>`) with two methods added.

## `ConvertStore`

```ts theme={null}
interface ConvertStore extends Readable<ConvertState> {
  convert(file: File, options?: ConvertOptions): Promise<void>;
  reset(): void;
}
```

### `convert(file, options)`

Upload a `File`/`Blob` via `POST /convert` (multipart), reporting progress via `XMLHttpRequest` (the store updates its status in each `progress` event).

<ParamField body="file" type="File" required>
  `<input type="file">` file, drag-and-drop, etc.
</ParamField>

<ParamField body="options" type="ConvertOptions" />

Returns `Promise<void>` — resolves when the store has finished updating (reads `$store.markdown`/`$store.json` for the result, not the return value).

### `reset()`

Returns the store to its initial state (`status: "idle"`, without `markdown`/`json`/`error`).

## `ConvertState`

```ts theme={null}
interface ConvertState {
  status: "idle" | "uploading" | "converting" | "success" | "error";
  progress: number;      // 0-100, solo vávavalid durante "uploading"
  markdown: string | null;
  json: JsonResult | null;
  error: MarkpdfError | null;
}
```

## `MarkpdfClient` (reexportado)

```ts theme={null}
import { MarkpdfClient } from "@markpdf/svelte";

const client = new MarkpdfClient({
  apiKey: "YOUR_API_KEY",
  baseUrl: "https://api.markpdf.tech",
  timeoutMs: 300_000,
  maxRetries: 2,
});
```

Identical to [`@markpdf/sdk`](/docs/sdks/nodejs/reference#markpdfclient) client — same methods (`convertFile`, `convertFromUrl`, `convertStream`, `pdfIndex`, `getJob`) and constructor options.

## Tipos

```ts theme={null}
import type {
  ConvertOptions,
  ConvertResult,
  Job,
  JsonResult,
  MarkpdfClientOptions,
} from "@markpdf/svelte";

import type { ConvertStore, ConvertState, ConvertStatus } from "@markpdf/svelte";
```
