Translate a PDF to Hindi (or any Indic language)
Translate a PDF to Hindi (or any Indic language)
This guide walks through translating a PDF from English into Hindi using the Document Translation API. The same flow works for Word, Excel, PowerPoint, and HTML — only the upload Content-Type changes.
Need to translate a sentence or paragraph instead of a file? Use the Text Translation API.
Prerequisites
- A Sarvam API key from Key Management
- Python 3.10+ with
pip install sarvamai httpx - A PDF file on disk (example:
report.pdf)
Billing: ₹20 per 10,000 billable characters per target language (after parsing). See Pricing.
Steps
Create the job
Call document_translation.create with source language, target language(s), and the original filename. You receive a job_id and a signed upload_url.
Upload the PDF
PUT the file bytes to upload_url with Content-Type: application/pdf and x-ms-blob-type: BlockBlob. The SDK does not upload for you yet.
Start translation
POST start (via client.document_translation.start(job_id=...)). The pipeline parses the PDF, runs OCR where needed, and translates each target language.
Poll until complete
Poll get_live_status every 10–15 seconds until each target language’s state is Completed. See Poll and export.
Example (create, upload, start)
Continue with the polling and export loop in Poll and export.
Related guides
- Poll and export — Word, PowerPoint, and multi-language export
- Document Translation overview
- Pricing · Rate limits