Skip to main content

Ejemplos

Convert a user upload (FastAPI)

convert_raw_bytes(data, filename=..., **params) is the variant of convert_file for when you already have the content in memory (for example, a FastAPI UploadFile) and you don’t want to write it to disk first.

PDF large with page range

Combine it with pdf_index to know what range to order without downloading the entire PDF client-side.

BYOS: upload the result directly to your storage

With output_url, API uploads the Markdown directly to your storage (S3, R2, Supabase Storage, GCS) and returns a lightweight JSON instead of the full body — useful for batch pipelines where you don’t want the Markdown to go through your own backend. See Compression for values ​​of output_encoding.

Pipeline RAG with /pdf/index

This flow avoids paying the cost (tokens + latency) of converting 500 pages when the agent only needs 12. See PDF Index for IA agents.

Process a ZIP

File size and quantity limits within ZIP are documented in Limits. An out-of-range ZIP returns 413, which SDK converts to MarkpdfPayloadTooLargeError.

Convert many files in parallel (async)

AsyncClient reuses a single underlying HTTP/2 connection, so launching parallel conversions with asyncio.gather is more efficient than opening a synchronous Client per file.