Skip to content
Image to PDF Photos, scans, receipts

JPG To PDF API

You're not "just converting images." You're trying to ship a workflow that won't break when users upload rotated receipts, massive camera photos, or expect readable text in the output PDF. This endpoint handles photographic compression and fit-to-page logic—so you stop babysitting JPG/JPEG uploads. Need the full suite? Start with the PDF API.

📸 📄

Converting 214M+ images to PDF

8,700+ teams shipped with it
Median conversion: 420ms
38-72% payload reduction

JPG → PDF Conversion

Optimized
# cURL
curl -X POST "https://api.xspdf.com/v1/convert/jpg-to-pdf" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_url": "https://files.example.com/receipt.jpg",
    "options": {
      "fit_to_page": "A4",
      "compression": "balanced",
      "dpi": 300
    }
  }'

Speed

420ms

Success

99.95%

Smaller

-38%

Handles rotated images, massive files, and text readability. See Receipt Capture for real-world examples.

214M+

images converted to PDF

47 min/day

saved per ops team (avg)

38%

median PDF size reduction

99.95%

successful conversions (30d)

You know the feeling when a "simple conversion" becomes a support nightmare

The user uploads a JPG. Your conversion adds 500KB of bloat. Or shrinks a receipt until the text is unreadable. Or crops the edges so half the content is missing. Support tickets pile up. Users ask "why is it broken?"

"It's cropped"

The PDF cuts off edges because the fit-to-page logic doesn't preserve aspect ratio.

"It's huge"

A 2MB camera photo becomes a 3.5MB PDF because compression settings aren't tuned for photos.

"It's unreadable"

Text on receipts or invoices becomes muddy artifacts after aggressive compression.

The hidden cost

Every time a user has to re-upload because "the PDF looks wrong," you lose trust. Users don't debug compression settings. They switch to a competitor whose "upload" button just works.

There's a better way than "center image on A4 and pray"

This API handles the fit-to-page math, compression tuning, and edge cases so your upload flow doesn't break on real-world images.

Fit-to-page that stays human-readable

Automatically scales and centers images while preserving aspect ratio—no cropping, no distortion, no "tiny doc" PDFs.

Compression tuned for "photo + text"

Balances file size and readability—receipts, invoices, and forms stay legible while camera photos shrink by 38–72%.

Fast enough for upload flows

Median 420ms conversion time means users don't wait, and your pipeline doesn't bottleneck on image processing.

Read the FAQs

Python Example

import requests

response = requests.post(
    "https://api.xspdf.com/v1/convert/jpg-to-pdf",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "input_url": "https://files.example.com/receipt.jpg",
        "options": {
            "fit_to_page": "A4",
            "compression": "balanced",
            "dpi": 300,
            "preserve_aspect_ratio": True
        }
    }
)

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

Outcomes your users notice instantly

Built for real-world upload flows—handles rotated images, massive files, and batch processing without breaking your UX.

Fit-to-page that prevents "tiny doc" PDFs

Automatically scales images to fill the page while preserving aspect ratio—no more 1-inch receipts floating in white space.

Smaller files without "muddy text"

Compression optimized for documents with text—reduces file size by 38–72% while keeping small print readable.

Faster "submit" moments

420ms median conversion means users don't stare at spinners—upload, convert, done, before they notice.

Multi-page PDFs from batches (in order)

Send an array of JPGs, get one PDF with pages in the right sequence—perfect for multi-page receipts and scanned docs.

Handles real camera chaos

Auto-rotation for EXIF-tagged photos, CMYK/RGB color space handling, and support for progressive JPEGs—just works.

Predictable, safe defaults

One API call, no guesswork—fit-to-page = A4, compression = balanced, DPI = 300. Override anything, or ship as-is.

FAQ: what teams ask before they ship this

Real questions from developers integrating JPG-to-PDF conversion into production workflows.

How does your "Fit to Page" work (and how do I avoid cropping)?

By default, we scale your JPG to fit within the PDF page dimensions (e.g., A4, Letter) while preserving the original aspect ratio. That means:

  • A portrait receipt (1200×1600) fits perfectly on a portrait A4 page—no cropping, no distortion.
  • A landscape photo (4000×3000) is centered on a landscape-oriented page—white margins top/bottom, but the whole image is visible.
  • Set preserve_aspect_ratio: false if you want to stretch the image to fill the page (not recommended for text-heavy content).

You'll never get a "tiny doc floating in white space" or "half the content cut off" unless you explicitly override the defaults.

Will compression destroy small text on receipts and invoices?

No. We use compression: "balanced" by default, which is tuned for documents that mix photos and text. Here's what happens:

  • Receipts/invoices (text-heavy): JPEG quality is set high enough (85–90) to keep small print legible. File size shrinks ~38% vs. the original JPG.
  • Camera photos (color-rich): We apply more aggressive compression (~70–80 quality) because photos tolerate lossy compression better. File size drops 50–72%.
  • Need pixel-perfect fidelity? Set compression: "lossless" to embed the JPG as-is (larger file, zero quality loss).
  • Need smallest possible file? Set compression: "maximum" (quality ~60–70)—good for thumbnails, not recommended for archival docs.

We've processed 214M+ images. The default "balanced" mode works for 99% of use cases—text stays readable, file size stays reasonable.

Can I convert multiple JPGs into one multi-page PDF?

Yes. Send an array of input_urls:

{
  "input_urls": [
    "https://files.example.com/page1.jpg",
    "https://files.example.com/page2.jpg",
    "https://files.example.com/page3.jpg"
  ],
  "options": {
    "fit_to_page": "A4",
    "compression": "balanced"
  }
}

You'll get one PDF with 3 pages, in order. Perfect for multi-page receipts, scanned forms, or batched uploads.

What if my user uploads a rotated phone photo?

We auto-rotate based on EXIF orientation data. If the camera saved "this photo was taken in portrait mode" in the metadata, we'll rotate it before embedding in the PDF—so users never see sideways receipts.

If the JPG has no EXIF data (common with screenshots or web images), we assume "upright" orientation. You can override with rotation_degrees: 90 if needed.

How fast is it? Will it bottleneck my upload flow?

Median conversion time is 420ms for typical receipts/photos (1–3MB JPGs). Large camera photos (8–12MB) might take 800ms–1.2s.

We scale horizontally—bursts of 1,000 concurrent conversions are fine. Your bottleneck will be network I/O (downloading the JPG from your storage), not our processing time.

For ultra-low-latency UX, use async webhooks: POST the job, return immediately, we'll webhook you when the PDF is ready (~420ms later).

Does this work with JPEG, JPG, and JFIF files?

Yes. We support all JPEG variants: .jpg, .jpeg, .jfif, progressive JPEGs, and CMYK color space. The API detects the format automatically—you don't need to specify it.

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

Stop debugging image uploads. Start shipping.

Join 8,700+ teams using xspdf to handle JPG-to-PDF conversion without the support headaches. No credit card required. Free tier includes 1,000 conversions/month.

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