/// REFERENCE

How do I convert between document formats?

Office documents to PDF with office-to-pdf, and PDF to editable Word with pdf-to-docx — inputs, page-setup options, queueing and error codes.

Published: Last updated:

Answer: Two conversion tools are documented here. office-to-pdf (POST /api/v1/tools/office-to-pdf, two credits) turns Word, Excel, PowerPoint and OpenDocument files into PDF. pdf-to-docx (POST /api/v2/tools/pdf-to-docx, two credits) turns a PDF that has a text layer into an editable Word document; a scan is refused with 422 no_text_layer.

office-to-pdf

A v1 file tool: send the document as multipart files= and any options as a JSON options field. The page-setup options in the table (fit, orientation, paper, sheets, single_page_sheets, scale) are read only on deployments with Office PDF options enabled; elsewhere the file converts exactly as sent and options are ignored. Where they are read, an unknown key is ignored and a known key with a bad value is a 422.

bash
curl -X POST https://www.ashdocs.com/api/v1/tools/office-to-pdf \
  -H "X-API-Key: ash_test_xxxxxxxx" \
  -F "files=@quarterly-report.xlsx" \
  -F 'options={"fit":"auto"}'

pdf-to-docx

A v2 file tool: send the PDF as multipart file= (singular). It takes no options. Long documents are queued, as the table says.

bash
curl -X POST https://www.ashdocs.com/api/v2/tools/pdf-to-docx \
  -H "X-API-Key: ash_test_xxxxxxxx" \
  -F "file=@contract.pdf"

Inputs, options and responses

Generated from the backend source.

Sent inKeyWhat it does
fileoffice-to-pdf input typesAccepted extensions: doc, docx, xls, xlsx, ppt, pptx, odt, ods, odp, rtf, txt, csv, tsv.
office-to-pdf optionsfitnone, auto, width, page. Default none — exactly today's conversion. auto measures the used range and rotates or scales only when it does not fit.
office-to-pdf optionsorientationauto, portrait, landscape. Default auto.
office-to-pdf optionspaperauto, A4, Letter. Default auto keeps the workbook's own paper size.
office-to-pdf optionssheetsall (default), active, or a list of sheet names.
office-to-pdf optionssingle_page_sheetstrue puts each sheet on one page. Default false.
office-to-pdf optionsscalePrint scale in percent, 10–400. Unset by default.
responsepdf-to-docx 422 no_text_layerThe PDF has no extractable text (a scan). Run ocr first, then convert its output.
responsepdf-to-docx queueingA PDF over 20 pages is queued: 202 with a job id; the DOCX arrives by webhook or polling. Shorter PDFs return synchronously.
filepdf-to-docx page limitAt most 200 pages per document.

Frequently asked questions

Why does my spreadsheet split across pages?

fit defaults to none, which converts the workbook exactly as its own print settings say. Where Office PDF options are enabled, send fit: auto to rotate or scale a sheet that does not fit.

Can pdf-to-docx convert a scanned PDF?

No — it returns 422 no_text_layer. Run ocr first, then convert the OCR'd file.

Why do I get 202 from pdf-to-docx?

The PDF is long enough to be queued; the response carries a job id, and the DOCX arrives on your webhook or by polling the job.