Your users upload PDFs. They want to preview page 1 before downloading the full file.
Most solutions involve installing Poppler, Ghostscript, or some native binary on your server. That works until it does not: CI pipelines break, Alpine Linux builds fail, memory spikes kill your serverless function.
There is a cleaner path.
Forgelab PDF API now converts PDFs to images
Send a PDF, get back PNG or JPEG images — one per page, or just the pages you need.
Quick start
# Convert the first page to PNG
curl -X POST https://www.forgelab.africa/api/pdf/to-images \
-H "X-API-Key: your_key" \
-F "file=@document.pdf" \
-F "page=1" \
--output page1.png
Node.js example
import FormData from 'form-data';
import fs from 'fs';
import fetch from 'node-fetch';
const form = new FormData();
form.append('file', fs.createReadStream('document.pdf'));
form.append('page', '1');
form.append('format', 'png');
const res = await fetch('https://www.forgelab.africa/api/pdf/to-images', {
method: 'POST',
headers: {
'X-API-Key': process.env.FORGELAB_API_KEY,
...form.getHeaders(),
},
body: form,
});
const buffer = await res.arrayBuffer();
fs.writeFileSync('page1.png', Buffer.from(buffer));
Python example
import requests
with open('document.pdf', 'rb') as f:
res = requests.post(
'https://www.forgelab.africa/api/pdf/to-images',
headers={'X-API-Key': 'your_key'},
files={'file': f},
data={'page': '1', 'format': 'jpeg'},
)
with open('page1.jpg', 'wb') as out:
out.write(res.content)
What this solves
Typical use cases:
- Document preview — show page 1 as a thumbnail before users download the full file
- Viewer apps — render pages on demand instead of loading the entire PDF in the browser
- Thumbnail generation — auto-generate cover images for uploaded documents
- E-signature flows — render pages as images for annotation layers
No binary dependencies on your server
The entire conversion runs server-side at Forgelab. Your app stays lean:
- No Poppler
- No Ghostscript
- No ImageMagick
- No temp file management
- No memory spikes from in-process rendering
Works from any language that can make an HTTP request.
Pricing
| Tier | Price | Calls/month |
|---|---|---|
| Free | $0 | 5 calls |
| Starter | $5/month | 100 calls |
| Pro | $15/month | 1,000 calls |
| Business | $30/month | 10,000 calls |
No credit card required for the free tier.
Get your API key at forgelab.africa — the PDF API also handles merge, split, compress, and convert, all on the same key.
Top comments (0)