Skip to content
Image to PDF Screenshots, UI exports, web graphics

PNG To PDF API

Transparent PNGs look perfect in the browser… then turn into ugly black boxes or random backgrounds in PDFs. This API converts PNG to PDF with predictable transparency handling—rendering alpha onto clean white pages so your screenshots, UI mockups, and exports look exactly "client-ready." Need the full suite? Start with the PDF API.

🖼️ 📄

Converting 128.7M+ PNGs to PDF

18,400+ teams using it
Median conversion: 420ms
99.95% successful conversions

PNG → PDF Conversion

Alpha Compositing
# cURL
curl -X POST "https://api.xspdf.com/v1/convert/png-to-pdf" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_url": "https://files.example.com/screenshot.png",
    "options": {
      "fit_to_page": "A4",
      "white_background": true,
      "preserve_transparency": false
    }
  }'

Speed

420ms

Success

99.95%

Clean

100%

Handles transparent edges, shadows, and anti-aliasing. See Design Portfolios for portfolio workflows.

128.7M+

files processed

47 min/day

saved per designer

3.1M+

multi-page PDFs generated

0

background guesswork

You know the feeling when a "simple screenshot" becomes a support ticket

You export UI from Figma, grab a browser screenshot, or generate charts server-side—everything's a clean PNG with transparency. Then you convert it to PDF and… the corners go dark, the shadows look crunchy, the background turns gray, and suddenly your "final" doc looks unprofessional.

The "alpha surprise"

PNG transparency isn't "empty." If your converter doesn't composite correctly, the PDF viewer fills it in unpredictably.

Web graphics aren't print graphics

A PNG that looks perfect on a dark webpage can look wrong on a white PDF page—unless it's intentionally blended.

Death by re-export

Once a PDF is "wrong," you're stuck: re-export assets, re-run conversions, re-send files, and re-gain trust.

The hidden cost

Every "Why does this look different?" message slows shipping and chips away at confidence. Users don't debug alpha channels. They find a competitor whose export button just works.

There's a better way: flatten transparency on purpose

Our convert png to pdf API composites transparent pixels onto a white PDF page before writing the final document. That means shadows, rounded corners, and anti-aliased edges render cleanly—without relying on viewer quirks.

1

Upload or URL in

Send your PNG (screenshot, UI export, chart render) directly from your app—no manual steps.

2

Alpha compositing to white

Transparent areas are blended onto a white canvas so the PDF page background is consistent everywhere.

3

PDF out—ready to share

Download or stream a crisp PDF your customers can open in Chrome, Preview, Acrobat, and mobile readers.

Read the FAQs

Python Example

import requests

response = requests.post(
    "https://api.xspdf.com/v1/convert/png-to-pdf",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "input_url": "https://files.example.com/ui-screenshot.png",
        "options": {
            "fit_to_page": "A4",
            "white_background": True,
            "preserve_aspect_ratio": True
        }
    }
)

pdf_url = response.json()["output_url"]
print(f"PDF ready: {pdf_url}")

Built for the PNGs you actually generate

Screenshots, UI exports, charts, badges, and icons all share the same problem: subtle transparent edges. These features are designed around that reality—not generic "file conversion."

No halo, no jagged edges

Anti-aliased PNG edges are composited onto white so rounded corners and shadows stay smooth.

Screenshot-ready pages

Convert single PNGs into clean one-page PDFs that look like "printed UI," not a pasted bitmap.

Batch into a single PDF

Turn a sequence of screenshots into a paginated PDF for QA, bug reports, or stakeholder review.

Predictable margins & fit

Keep content centered and readable—no accidental cropping or microscopic output that screams "automated."

Consistent across PDF viewers

Reduce "it looks different on my computer" by flattening transparency before the PDF is finalized.

Fast enough for real workflows

Generate PDFs during upload, export, or send flows—without turning your app into a queue of "wait… still processing."

FAQ: PNG to PDF without transparency headaches

These are the questions people ask right before they give up and ship a "good enough" PDF. Don't.

How does the API handle PNG transparency (alpha channel)?

Transparent pixels are composited onto a white background before the PDF is produced. This prevents black/gray fills, weird "checkerboard" artifacts, and viewer-dependent rendering differences. The result is a PDF page that behaves like paper: white and consistent.

Will my PDF look the same in Chrome, Preview, and Adobe Acrobat?

Yes—flattening the alpha onto white removes one of the biggest sources of "viewer variance." When transparency is left unresolved, different PDF renderers can interpret it differently. Compositing upfront makes output far more predictable.

Can I combine multiple PNG screenshots into one multi-page PDF?

Yes. This is ideal for bug reports, QA runs, onboarding docs, and client reviews—where sending "12 separate images" looks messy. For a broader set of PDF workflows (merge, split, stamp), the full overview is on our PDF API page.

What's the best workflow for a portfolio PDF from transparent UI exports?

Export PNGs with transparency (for clean edges), then convert them into PDF pages with white compositing so every slide reads like print. For structure—project order, captions, and "what to include"—use our Design Portfolios guide and generate a polished, sendable PDF in minutes.

Still have questions? Check the full API docs or reach out to our team.

Stop debugging transparency. Start shipping.

Join 18,400+ teams using xspdf to handle PNG-to-PDF conversion without the alpha channel headaches. No credit card required. Free tier includes 1,000 conversions/month.

See how we handle JPG to PDF, TIFF to PDF, and 40+ more PDF operations.