Skip to content
pdfconversionapi

PUB to PNG API

POST /v2/convert/pub/to/png draws every page of a Microsoft Publisher file as its own PNG. Our Letter-size book sale flyer comes back as two 1,275 × 1,650 RGB images at the default 150 DPI, book-sale-flyer-1.png and -2.png.

Endpoint
POST /v2/convert/pub/to/png
Accepts
pub
Sample timing
0.521 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/png \
  -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.521 s median2 files, 332 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.521,
  "Files": [
    {
      "FileName": "book-sale-flyer-1.png",
      "FileExt": "png",
      "FileSize": 216166,
      "FileData": "iVBORw0KGgoAAAANSUhEUgAA…"
    },
    {
      "FileName": "book-sale-flyer-2.png",
      "FileExt": "png",
      "FileSize": 123435,
      "FileData": "iVBORw0KGgoAAAANSUhEUgAA…"
    }
  ]
}

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.png, rendered by the API
Input
book-sale-flyer.pub (10 KB)
Output
book-sale-flyer-1.png (211 KB)book-sale-flyer-2.png (121 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
ImageResolutioninteger, default 150One value for both directions, stored in the PNG when sent. 72 made the volunteer page 612 × 792 and 47,582 bytes.Values: 36–600
ImageWidthintegerWidth in pixels; the flyer page is drawn at the scale it needs.Values: 1–20000
ImageHeightintegerHeight in pixels. An 850 × 850 box with ImageWidth gives a 657 × 850 page.Values: 1–20000
ScaleProportionsboolean, default truefalse stretches the Letter page to the box, 850 × 850 for example.
ScaleImageboolean, default truefalse crops the box from the top-left corner of the page at 150 DPI.
ScaleIfLargerboolean, default falsetrue keeps the page at its rendered size when you ask for more pixels, such as ImageWidth=2550.
TransparentColorstringOne exact color to clear: white cleared 1,608,442 of the 2,103,750 pixels on the front page, leaving the banner, the ellipse and the text.Values: color name, #RRGGBB or R,G,B
ColorSpaceenum, default defaultgray writes a one-channel PNG (85,708 bytes for the front page), monochrome one with only black and white (31,413 bytes), and rgb the same three-channel 216,166-byte file as the default.Values: default, rgb, gray, monochrome
PageRangestringPages to draw; 1 returns the front of the flyer only.
FileNamestringStem for the numbered files.
StoreFileboolean, default falseReturn links to the stored PNGs, valid for 3 hours.

Not supported yet

Setting one of these to anything but its default returns 400.

OptionWhat to do instead
ImageResolutionHReturns 400 "ImageResolutionH is not supported yet for PUB → PNG". Use ImageResolution, which sets both directions.
ImageResolutionVSame as ImageResolutionH.
TextAntialiasingText is always drawn with smoothed edges; 0 returns 400.

Also refused when set: GraphicsAntialiasing, UseCIEColor.

What carries over, and what doesn't

Kept

  • One PNG per publication page, 1,275 × 1,650 for US Letter at 150 DPI
  • Exact fill colors such as the #FF9933 banner and the yellow badge, with no compression artifacts
  • Every text run at its size and weight, drawn with smooth edges
  • Three color channels with no alpha channel; TransparentColor adds one

Lost or not yet supported

  • The file's own font faces: all text renders in one sans-serif family.
  • A background color of your choice: the page is drawn on white, and BackgroundColor=black returned both PNGs pixel for pixel unchanged.
  • DPI in the file, unless ImageResolution is sent.

Limits

  • Antialiasing and separate horizontal and vertical resolutions, which ConvertAPI documents for this pair, return 400 when set to anything but their defaults.
  • 100,000,000 pixels and 16,000 pixels per side per page; larger sizes return 413.
  • Up to 10 MB on the Free plan or 100 MB on paid plans per request, 2,000 pages, and 120 seconds per conversion.

Where teams use it

Thumbnails for a template gallery

A site that offers flyers, menus or certificates as .pub downloads can show a PNG of each page next to the file. ImageWidth=300 gave 300 × 388 previews of 32,448 and 16,704 bytes.

Checking old publications before migration

Before moving an archive of .pub files to another tool, render the pages to see what each one contains, without opening Publisher.

Cut-out artwork

TransparentColor=white keeps the colored banner and badge on a clear background, so they can be reused on a web page.

Questions

How do I set the resolution?

Send ImageResolution, for example 300 for print-size pages. ImageResolutionH and ImageResolutionV are not read yet and return 400; their default of 200 is accepted.

Can I convert only the first page of a publication?

Yes, with PageRange=1. Without it, the response holds one PNG per page in page order.

Do I get a transparent background?

Only if you ask: TransparentColor=white made 76.5% of the front page transparent. Otherwise every pixel is opaque.

Convert your first PUB file in a minute.