Skip to content
pdfconversionapi

PUB to WebP API

POST /v2/convert/pub/to/webp turns each page of a Microsoft Publisher file into a lossless WebP. Our two-page flyer returns 1,275 × 1,650 images of 122,634 and 37,560 bytes at the default 150 DPI.

Endpoint
POST /v2/convert/pub/to/webp
Accepts
pub
Sample timing
0.531 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/webp \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@book-sale-flyer.pub \
  -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
fi
200 OK0.531 s median2 files, 156 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.531,
  "Files": [
    {
      "FileName": "book-sale-flyer-1.webp",
      "FileExt": "webp",
      "FileSize": 122634,
      "FileData": "UklGRgLfAQBXRUJQVlA4TPbe…"
    },
    {
      "FileName": "book-sale-flyer-2.webp",
      "FileExt": "webp",
      "FileSize": 37560,
      "FileData": "UklGRrCSAABXRUJQVlA4TKSS…"
    }
  ]
}

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.

First page of book-sale-flyer-1.webp, rendered by the API
Input
book-sale-flyer.pub (10 KB)
Output
book-sale-flyer-1.webp (120 KB)book-sale-flyer-2.webp (37 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.

ParameterWhat it does
ImageWidthintegerWidth in pixels: 850 gave 850 × 1,100 pages of 77,536 and 23,086 bytes.Values: 1–20000
ImageHeightintegerHeight in pixels.Values: 1–20000
ImageResolutioninteger, default 150Sets the pixel size; WebP files don't store DPI.Values: 36–600
ScaleProportionsboolean, default truefalse stretches the page to the exact box.
ScaleImageboolean, default truefalse crops the top-left corner instead of scaling.
ScaleIfLargerboolean, default falsetrue keeps pages from being enlarged.
TransparentColorstringClears one exact color: white cleared 1,608,442 pixels of the front page (132,076 bytes).Values: color name, #RRGGBB or R,G,B
ColorSpaceenum, default defaultgray (68,288 bytes for the front page) and monochrome (15,606) change the pixels; WebP has no gray mode, so the file stays an RGB image.Values: default, rgb, gray, monochrome
PageRangestringPages to convert; 2 returns the volunteer page alone.
FileNamestringStem for the numbered .webp files.
StoreFileboolean, default falseReturn links to the stored files, valid for 3 hours.

What carries over, and what doesn't

Kept

  • Every rendered pixel: the WebP is lossless (VP8L)
  • One image per page, 1,275 × 1,650 at 150 DPI
  • Fill and text colors as drawn, with no alpha channel unless TransparentColor is set

Lost or not yet supported

  • A lossy mode: the output is always lossless.
  • DPI metadata, which WebP has no place for.
  • The publication's font faces, replaced by one sans-serif family.

Limits

  • ConvertAPI documents no options for this pair, so options the route doesn't read are ignored: ImageQuality=30, ImageResolutionH=300, TiffType, JpgType and TextAntialiasing=0 all returned 200 with unchanged files. The same antialiasing and H/V resolution options return 400 on pub/to/png.
  • 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

Flyers on a website

A library, school or club site can show each page of a .pub flyer as WebP with the same pixels as PNG: 57% of the PNG's bytes for the sample's front page and 30% for its volunteer page.

Previews in a file-sharing app

Show page images of uploaded publications at the width of the preview pane with ImageWidth.

Questions

Can I choose a quality level?

No. The WebP files are lossless, and ImageQuality is ignored on this route. Reduce the size with ImageWidth: 850 pixels wide brought the front page from 122,634 to 77,536 bytes.

Why does an option work differently here than on PUB to PNG?

On pub/to/png we refuse ConvertAPI's documented options that we don't apply, such as ImageResolutionH. ConvertAPI documents none for WebP, so unknown options are ignored here, as ConvertAPI does.

How much smaller is WebP than PNG for a Publisher page?

For the flyer's front page, 122,634 bytes against 216,166, 57% of the PNG. The volunteer page went from 123,435 to 37,560 bytes.

Convert your first PUB file in a minute.