Office to PDF
curl --request POST \
--url https://api.pdfbase.dev/v1/convert/office \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"filename": "<string>",
"landscape": true,
"format": "<string>",
"compress": "<string>",
"output": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/convert/office"
payload = {
"source": {},
"filename": "<string>",
"landscape": True,
"format": "<string>",
"compress": "<string>",
"output": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {},
filename: '<string>',
landscape: true,
format: '<string>',
compress: '<string>',
output: '<string>'
})
};
fetch('https://api.pdfbase.dev/v1/convert/office', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/convert/office",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
],
'filename' => '<string>',
'landscape' => true,
'format' => '<string>',
'compress' => '<string>',
'output' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/convert/office"
payload := strings.NewReader("{\n \"source\": {},\n \"filename\": \"<string>\",\n \"landscape\": true,\n \"format\": \"<string>\",\n \"compress\": \"<string>\",\n \"output\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pdfbase.dev/v1/convert/office")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"filename\": \"<string>\",\n \"landscape\": true,\n \"format\": \"<string>\",\n \"compress\": \"<string>\",\n \"output\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/convert/office")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {},\n \"filename\": \"<string>\",\n \"landscape\": true,\n \"format\": \"<string>\",\n \"compress\": \"<string>\",\n \"output\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyConvert
Office to PDF
Convert DOCX, XLSX, or PPTX files to PDF.
POST
/
v1
/
convert
/
office
Office to PDF
curl --request POST \
--url https://api.pdfbase.dev/v1/convert/office \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"source": {},
"filename": "<string>",
"landscape": true,
"format": "<string>",
"compress": "<string>",
"output": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/convert/office"
payload = {
"source": {},
"filename": "<string>",
"landscape": True,
"format": "<string>",
"compress": "<string>",
"output": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source: {},
filename: '<string>',
landscape: true,
format: '<string>',
compress: '<string>',
output: '<string>'
})
};
fetch('https://api.pdfbase.dev/v1/convert/office', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/convert/office",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'source' => [
],
'filename' => '<string>',
'landscape' => true,
'format' => '<string>',
'compress' => '<string>',
'output' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/convert/office"
payload := strings.NewReader("{\n \"source\": {},\n \"filename\": \"<string>\",\n \"landscape\": true,\n \"format\": \"<string>\",\n \"compress\": \"<string>\",\n \"output\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pdfbase.dev/v1/convert/office")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {},\n \"filename\": \"<string>\",\n \"landscape\": true,\n \"format\": \"<string>\",\n \"compress\": \"<string>\",\n \"output\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/convert/office")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source\": {},\n \"filename\": \"<string>\",\n \"landscape\": true,\n \"format\": \"<string>\",\n \"compress\": \"<string>\",\n \"output\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPhase
Phase 2 — Uses Gotenberg (LibreOffice) under the hood.Request
object
required
The Office document to convert. One of:
{ "url": "https://example.com/report.docx" }{ "base64": "UEsDBBQ..." }withfilenamerequired.
string
Required when using
base64. Must include the file extension to determine format: .docx, .xlsx, .pptx, .odt, .ods, .odp.boolean
default:"false"
Force landscape orientation. Useful for spreadsheets.
string
default:"a4"
Page size for the output PDF.
string
default:"none"
Compression for the output.
string
default:"url"
url or base64.Supported formats
| Input | Extension | Notes |
|---|---|---|
| Word | .docx, .doc | Full layout support |
| Excel | .xlsx, .xls | Each sheet becomes a page. Headers/footers preserved. |
| PowerPoint | .pptx, .ppt | One slide per page. Animations stripped. |
| OpenDocument | .odt, .ods, .odp | Native support via LibreOffice |
Conversion quality depends on font availability. PDFBase bundles 200+ common fonts (Google Fonts, Microsoft core fonts). Custom fonts in Office documents may fall back to similar alternatives.
Response
{
"id": "pdf_converted1",
"object": "pdf",
"status": "completed",
"url": "https://files.pdfbase.dev/pdf_converted1.pdf?token=sig_abc",
"pages": 12,
"bytes": 540000,
"source_format": "docx",
"created_at": "2026-05-19T13:20:00Z",
"expires_at": "2026-05-20T13:20:00Z",
"render_time_ms": 3200
}
Example
curl -X POST https://api.pdfbase.dev/v1/convert/office \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"source": { "url": "https://your-app.com/reports/monthly.xlsx" },
"landscape": true,
"format": "letter",
"output": "url"
}'