Skip to main content

Referencia

<MarkpdfProvider>

string
required
Tu API key. Se pasa tal cual a new MarkpdfClient().
string
default:"https://api.markpdf.tech"
URL base of API.
ReactNode
required
Component tree with access to the client via useMarkpdf()/useConvertFile().
The client is memoized with useMemo based on apiKey/baseUrl, so it is not recreated on each render.

useMarkpdf()

Returns the MarkpdfClient share created by MarkpdfProvider. Throws a Error if called outside of a <MarkpdfProvider>. Exposes all methods documented in the Node.js/TypeScript SDK reference: convertFile, convertFromUrl, convertStream, pdfIndex, getJob.

useConvertFile()

Hook to upload a File/Blob with progress, backed by XMLHttpRequest against POST /convert (multipart). Must be used within <MarkpdfProvider>.

convert(file, options)

File
required
File selected by the user (from <input type=\"file\">, drag-and-drop, etc.).
ConvertOptions
Returns a promise that resolves to the Markdown (string) or the JsonResult object (if responseFormat: "json").

status state machine

reset()

Returns the status to "idle" and clears markdown, json and error. Useful to allow a new upload without disassembling the component.

Tipos

@markpdf/react re-exports the relevant types from @markpdf/sdk:
See full SDK base types for JsonResult and JobStatus.