Vanguard AI

PDF to Word

Turn a PDF into an editable .docx. Page 1 of the PDF starts page 1 of the Word file, at the same size and orientation; headings, lists and tables come through as real Word structures, and the Lao font is embedded so the file reads the same on any computer.

Lao is the reason this endpoint exists. Most converters copy the PDF’s hidden text layer, which for Lao is routinely broken — vowels and tone marks scattered, letters swapped. Here every page is read from its image, then checked:

  • Typed pages are compared letter by letter with the PDF’s own text, and small misreadings are corrected from it.
  • Scanned pages are read twice and the readings compared.
  • Where a check fails, a stronger model reads the page again, shown both versions.
  • A page that still cannot be read is placed in the Word file as a picture, so the document stays whole — and that page is not charged.

1. Upload the PDF

A PDF can be far larger than a request body may be, so it goes straight to storage.

POST /v1/docconvert/uploads API key

JSON body

contentType *
string
Always "application/pdf".
size *
number
File size in bytes. Up to 100 MB.

The response carries uploadUrl (PUT the file there with content-type: application/pdf) and the sourceKey to use below.

2. Inspect (optional, free)

POST /v1/docconvert/inspect API key

How many pages, whether they are typed or scanned, and the price — counted from the file itself, the same count the job is charged for.

200 What the conversion will cost
{
  "status": "success",
  "pages": 100,
  "kind": "digital",
  "scannedPages": 0,
  "maxPages": 300,
  "tooManyPages": false,
  "creditsPerPage": 1,
  "credits": 100,
  "affordable": true
}

3. Convert

POST /v1/docconvert/jobs API key

JSON body

sourceKey *
string
The key returned by the upload step.
fileName
string
Original file name; names the Word file.
face
modern | looped
Lao font for the Word file. Default: the style the PDF itself uses (looped for Phetsarath / Saysettha).
storageOption
none | platform | byo
Where the source and result are kept. Default: none (the Word file is kept 24 hours).

Poll GET /v1/jobs/{id}. While it runs, progress counts pages read:

200 Running
{
  "status": "success",
  "job": {
    "id": "9a2b7c10-...",
    "serviceId": "docconvert",
    "status": "processing",
    "progress": { "unit": "page", "done": 37, "total": 100 }
  }
}

When it succeeds, result is the quality report — how each page was checked, which pages are worth a human look (flagged), and which were placed as pictures (imagePages).

200 Finished
{
  "status": "success",
  "job": {
    "status": "success",
    "exportFormats": ["docx"],
    "result": {
      "pages": 100,
      "verified": 94,
      "doubleRead": 0,
      "reviewed": 6,
      "singleRead": 0,
      "imagePages": [],
      "flagged": [{ "page": 41, "score": 0.972 }],
      "corrected": 18,
      "face": "looped",
      "billedUnits": 100
    }
  }
}

4. Download

GET /v1/jobs/{id}/export?format=docx API key

Returns the Word file. The suggested file name is in the x-file-name header (percent-encoded — names are often Lao).