PDF Converter API

The Complete Toolkit for All Your PDF Conversion & Manipulation Needs.

hero banner

Code Examples in Popular Languages

Integrate our PDF Converter API easily into your apps with comprehensive code examples in popular languages to get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/document-converter' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'from="pdf"' \
--form 'to="enter_supported_format"' \
--form 'file=@"/D:/data/Document/pdf/file.pdf"'
JavaScript Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "enter_your_api_key");

const formdata = new FormData();
formdata.append("from", "pdf");
formdata.append("to", "enter_supported_format");
formdata.append("file", fileInput.files[0], "/D:/data/Document/pdf/file.pdf");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://theonlineconverter.com/api/v1/document-converter", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
Ruby Net::HTTP
import requests
import json

url = "https://theonlineconverter.com/api/v1/document-converter"

payload = {'from': 'pdf',
'to': 'enter_supported_format'}
files=[
  ('file',('file.pdf',open('/D:/data/Document/pdf/file.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
Python Requests
import requests
import json

url = "https://theonlineconverter.com/api/v1/document-converter"

payload = {'from': 'pdf',
'to': 'enter_supported_format'}
files=[
  ('file',('file.pdf',open('/D:/data/Document/pdf/file.pdf','rb'),'application/pdf'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
PHP Guzzle
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'x-api-key' => 'enter_your_api_key'
];
$options = [
  'multipart' => [
    [
      'name' => 'from',
      'contents' => 'pdf'
    ],
    [
      'name' => 'to',
      'contents' => 'enter_supported_format'
    ],
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Document/pdf/file.pdf', 'r'),
      'filename' => '/D:/data/Document/pdf/file.pdf',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/document-converter', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Java HttpURLConnection
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("from","pdf")
  .addFormDataPart("to","enter_supported_format")
  .addFormDataPart("file","/D:/data/Document/pdf/file.pdf",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Document/pdf/file.pdf")))
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/document-converter")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("x-api-key", "enter_your_api_key")
  .build();
Response response = client.newCall(request).execute();
Go net/http
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "net/http"
  "io"
)

func main() {

  url := "https://theonlineconverter.com/api/v1/document-converter"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  _ = writer.WriteField("from", "pdf")
  _ = writer.WriteField("to", "enter_supported_format")
  file, errFile3 := os.Open("/D:/data/Document/pdf/file.pdf")
  defer file.Close()
  part3,
         errFile3 := writer.CreateFormFile("file",filepath.Base("/D:/data/Document/pdf/file.pdf"))
  _, errFile3 = io.Copy(part3, file)
  if errFile3 != nil {
    fmt.Println(errFile3)
    return
  }
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "enter_your_api_key")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
C# HttpClient
var options = new RestClientOptions("https://theonlineconverter.com")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/v1/document-converter", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddParameter("from", "pdf");
request.AddParameter("to", "enter_supported_format");
request.AddFile("file", "/D:/data/Document/pdf/file.pdf");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our unified API provides a complete suite of tools to handle any PDF task with precision and speed.

Simple User Interface

PDF to Office & More

Convert PDFs into fully editable Word documents (.docx), structured Excel spreadsheets (.xlsx), and PowerPoint presentations (.pptx).

Simple Data Format

PDF to Image Formats

Rasterize PDF pages into high-quality image formats like JPG and PNG, perfect for generating previews, thumbnails, or web content.

Time

Create PDFs From Any File

Reliably convert Word, Excel, PowerPoint, and image files (JPG, PNG, etc.) into a universal, professional-looking PDF format.

Secure Data

Powerful PDF Manipulation

Go beyond conversion. Merge multiple PDFs into one, split a large PDF into smaller files, and compress documents to reduce their file size.

Universal Access

Advanced OCR for Scanned PDFs

Our built-in Optical Character Recognition (OCR) automatically processes scanned or image-based PDFs, making their content accessible for conversion and extraction.

Freedom

Secure & Scalable

All operations are performed over encrypted connections. Our infrastructure is built to handle high-volume batch processing for enterprise-level needs.

Frequently Asked Questions

Find answers to common questions about our comprehensive PDF Converter API to understand its full capabilities.

You specify the desired operation using the `task` parameter in your API request. For example, you would use `"task": "pdf-to-excel"` to convert a PDF to Excel or `"task": "compress"` to reduce its file size.

Our API automatically detects if a PDF is scanned (image-based). When it does, it engages our powerful OCR engine to "read" the text on the page before performing the requested conversion to an editable format like Word or Excel.

Our conversion engine is highly advanced and does an excellent job of preserving the original layout, including columns, tables, images, and text formatting. However, extremely complex, multi-layered layouts may require minor touch-ups.

Yes. You can first convert each file (e.g., a Word doc, an Excel sheet, a JPG image) to PDF using the API, and then use the "merge" task to combine the resulting PDFs into a single, cohesive document.

Yes, this is our unified endpoint. While we may have separate documentation pages for clarity (like PDF to JPG), they all can be accessed through this powerful, all-in-one PDF Converter API by simply changing the `task` parameter.

Yes. Most conversion tasks support a `pages` parameter, allowing you to specify exactly which pages you want to process from the source document (e.g., "1-5, 8").

Absolutely. We use end-to-end TLS encryption for all data transfers. Your files are processed securely and are permanently deleted from our servers immediately after the job is complete.