PUB to JPG API
POST /v2/convert/pub/to/jpg returns a JPEG for each page of a Microsoft Publisher file. The sample asks for ImageResolution=100, so the two Letter pages of our flyer come back 850 × 1,100 pixels, 113,742 and 58,659 bytes, with 100 DPI recorded.
- Endpoint
- POST /v2/
convert/ pub/ to/ jpg - Accepts
- pub
- Sample timing
- 0.534 s median of 5 runsHow we measure
- Request size
- Up to 10 MB on the Free plan or 100 MB on paid plans, all files together
Request and response
Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.
curl -sS -X POST \
https://api.pdfconversionapi.com/v2/convert/pub/to/jpg \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@book-sale-flyer.pub \
--form-string ImageResolution=100 \
-o response.json
# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
mkdir -p converted
name=$(jq -r '.Files[0].FileName' response.json)
jq -r '.Files[0].FileData' response.json \
| base64 --decode > "converted/$name"
else
cat response.json
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/pub/to/jpg",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("book-sale-flyer.pub", "rb"))],
data={
"ImageResolution": "100",
},
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "book-sale-flyer.pub";
form.append("File", new Blob([await readFile(file)]), file);
form.append("ImageResolution", "100");
const url = "https://api.pdfconversionapi.com/v2/convert/pub/to/jpg";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"ConversionCost": 1,
"ConversionTime": 0.534,
"Files": [
{
"FileName": "book-sale-flyer-1.jpg",
"FileExt": "jpg",
"FileSize": 113742,
"FileData": "/9j/4AAQSkZJRgABAgEAZABk…"
},
{
"FileName": "book-sale-flyer-2.jpg",
"FileExt": "jpg",
"FileSize": 58659,
"FileData": "/9j/4AAQSkZJRgABAgEAZABk…"
}
]
}Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.
The sample, converted
The same file the code sends. Download the input and the output and compare them yourself.

- Input
- book-sale-flyer.pub (10 KB)
- Output
- book-sale-flyer-1.jpg (111 KB)book-sale-flyer-2.jpg (57 KB)
- Source
- A two-page flyer for a fictional library book sale; we wrote our text and shapes into a small Publisher test file from an open-source office suite's test data (MPL-2.0). How it was made
- Made by
- 2026-11-04, API build
9eeeb0640aba
Parameters
Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.
| Parameter | What it does |
|---|---|
ImageResolutioninteger, default 150 | DPI of each page, also the density written into the JPEG. At 150 the front page is 1,275 × 1,650 and 207,607 bytes.Values: 36–600 |
ImageQualityinteger, default 85 | JPEG quality; ConvertAPI documents 75 as its default for Publisher files. The front page at 150 DPI was 207,607 bytes at 85 and 147,262 at 60.Values: 1–100 |
ImageWidthinteger | Width in pixels.Values: 1–20000 |
ImageHeightinteger | Height in pixels; with a width, an 850 × 850 box gave 657 × 850.Values: 1–20000 |
ScaleProportionsboolean, default true | false fills the box exactly (850 × 850), stretching the flyer. |
ScaleImageboolean, default true | false crops the top-left corner instead of scaling. |
ScaleIfLargerboolean, default false | true keeps a page from growing past its 150 DPI size. |
ColorSpaceenum, default default | gray writes one channel: the volunteer page at 100 DPI was 38,894 bytes.Values: default, rgb, gray, monochrome |
PageRangestring | Pages to convert, for example 1. |
FileNamestring | Stem for -1.jpg, -2.jpg. |
StoreFileboolean, default false | Return 3-hour links instead of the files. |
Not supported yet
Setting one of these to anything but its default returns 400.
| Option | What to do instead |
|---|---|
JpgType | Output is always a color baseline JPEG unless ColorSpace=gray; jpeggray returns 400 "JpgType is not supported yet for PUB → JPG". |
ImageResolutionH, ImageResolutionV | Use ImageResolution. |
Also refused when set: TextAntialiasing, GraphicsAntialiasing, UseCIEColor.
What carries over, and what doesn't
Kept
- Each page's US Letter proportions, 850 × 1,100 at 100 DPI
- Colors of fills, outlines and text, flattened onto the white page
- The DPI as JPEG density: the sample files record 100 × 100
Lost or not yet supported
- Transparency:
TransparentColoris accepted and changes nothing (the volunteer page stayed 113,628 bytes at 150 DPI). - The font faces named in the file, as on every Publisher route.
- Exact pixels, since JPEG compresses with loss.
Limits
JpgType,ImageResolutionH,ImageResolutionV,TextAntialiasing,GraphicsAntialiasingandUseCIEColorreturn 400 unless sent with ConvertAPI's defaults.- 100,000,000 pixels and 16,000 pixels per side per page.
- Up to 10 MB on the Free plan or 100 MB on paid plans per request and 120 seconds per conversion.
Where teams use it
Posting a flyer online
Event pages and community boards that take JPEG uploads can show the flyer as an image; 100 DPI keeps a Letter page under 120 KB in the sample.
Email previews of a newsletter
Send the front page as an inline JPEG with a link to the full PDF.
Gray proofs
ColorSpace=gray gives one-channel pages for a black-and-white proof print.
Questions
Why did `ImageResolutionH=300` fail?
This route reads one resolution for both directions, ImageResolution. The separate H and V values aren't read yet, so a value other than 200 returns 400 "ImageResolutionH is not supported yet for PUB → JPG".
How do ConvertAPI's defaults compare?
ConvertAPI documents quality 75 and 200 DPI for this pair. Ours are 85 and 150; send ImageQuality=75 and ImageResolution=200 to match.
Can I get gray JPEGs?
Yes, ColorSpace=gray. JpgType=jpeggray isn't read yet and returns 400.
Convert your first PUB file in a minute.