Skip to main content

Referencia

createConvertRouteHandler(config)

Returns { POST }, ready to re-export from route.ts. The handler accepts multipart/form-data with a file field (configurable, see fileField below) and returns the API response as is.

convertFormData(formData, options)

Extracts the file from a FormData (typically received as an argument to a Server Action) and calls convertFile of the underlying SDK. Intended to be used within a "use server" function.

convertUrlAction(url, options)

Direct wrapper for convertFromUrl of SDK, intended for Server Actions that receive a pre-signed URL instead of a file.

getServerClient(config)

Returns a cached instance of MarkpdfClient (memoized by apiKey + baseUrl within the same process) for when you need direct access to the entire client — for example, to use pdfIndex, convertStream, or getJob within a custom Route Handler or Server Action.
app/api/index/route.ts

Tipos re-exportados

@markpdf/nextjs re-exports the @markpdf/sdk types so you don’t need to install it separately if you only use the high-level helpers:
See Node.js SDK Reference for field-by-field details of each type.