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().useMemo based on apiKey/baseUrl, so it is not recreated on each render.
useMarkpdf()
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()
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
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:
JsonResult and JobStatus.