Free plan

Convert Document

Change a document into another type, like Word to PDF
POST
/v1/documents/convert

About this tool

This tool changes a document from one kind of file to another, for example Word to PDF, or PDF to Word. You choose the type you want. The types that are possible depend on the file you add. If your Word, Excel or PowerPoint file is locked, you can type its password so it can be opened.
For example, you turn a Word letter into a PDF so it looks the same on every phone and computer.

How to use it

  1. Choose this tool.
  2. Add your document with Upload or drag and drop.
  3. Choose the type you want to get, such as PDF or Word.
  4. Press Generate.
  5. Download the converted file.

What you get back

You get a new file in the type you chose, ready to download. The original is not changed.
GOOD TO KNOW
Requires LibreOffice (sandboxed) on the server: a runtime capability, see GET /v1/capabilities. PDF->office conversion reconstructs layout heuristically. Binary Office files (DOC / XLS / PPT) are converted only inside the full sandbox. DjVu and XPS are read by their own programs (djvulibre, libgxps; runtime capabilities) and can only be turned into PDF.
TEST IT LIVE

Try Convert Document in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/convert
Tool ID
documents.convert
Authentication
API key
Accepts
PDF, DOCX, XLSX, PPTX, ODT, ODS +25 more
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/convert" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'to=jpeg' \
  -F 'pdfaLevel=2b' \
  -F 'output_bundle=zip'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.convert({
    "file": 'document.pdf',
    "to": "jpeg",
    "pdfaLevel": "2b",
    "output_bundle": "zip"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->convert([
    'file' => 'document.pdf',
    'to' => 'jpeg',
    'pdfaLevel' => '2b',
    'output_bundle' => 'zip',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Change a document into another type, like Word to PDF. It can do several jobs from one endpoint: to, enum-field, items.

Convert Document accepts PDF, DOCX, XLSX, PPTX, ODT, ODS, ODP, RTF, EPUB, TXT, MD, HTML and 19 more. You can send several files in one request.

Convert Document is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/convert with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.