SDK methods for generating PDF documents from templates.
The client.pdf namespace provides typed methods for generating PDF documents from pre-defined templates. Currently supports offer letters and property flyers with server-side HTML-to-PDF rendering. Available in TypeScript, Python, and Go SDKs.
| SDK | Install | Namespace |
|---|---|---|
| TypeScript | npm install @caldera/platformxe-sdk | client.pdf |
| Python | pip install platformxe | client.pdf |
| Go | go get github.com/calderax/platformxe-go | client.Pdf |
Generate offer letter
Render an offer letter PDF from structured data.
const result = await client.pdf.offerLetter({
tenantName: 'Ada Okafor',
propertyAddress: '15 Admiralty Way, Lekki Phase 1, Lagos',
monthlyRent: 450000,
currency: 'NGN',
startDate: '2026-06-01',
duration: 12,
landlordName: 'Caldera Properties Ltd',
});
console.log(result.url); // Signed download URL
console.log(result.fileSize); // Size in bytes
result = client.pdf.offer_letter(
tenant_name="Ada Okafor",
property_address="15 Admiralty Way, Lekki Phase 1, Lagos",
monthly_rent=450000,
currency="NGN",
start_date="2026-06-01",
duration=12,
landlord_name="Caldera Properties Ltd",
)
result, err := client.Pdf.OfferLetter(map[string]interface{}{
"tenantName": "Ada Okafor",
"propertyAddress": "15 Admiralty Way, Lekki Phase 1, Lagos",
"monthlyRent": 450000,
"currency": "NGN",
"startDate": "2026-06-01",
"duration": 12,
"landlordName": "Caldera Properties Ltd",
})
Generate property flyer
Render a property flyer PDF for marketing or listing purposes.
const result = await client.pdf.propertyFlyer({
title: 'Luxury 3-Bedroom Apartment',
address: '15 Admiralty Way, Lekki Phase 1, Lagos',
price: 4500000,
currency: 'NGN',
bedrooms: 3,
bathrooms: 2,
features: ['Swimming pool', 'Gym', '24hr power', 'Secure parking'],
images: [
'https://storage.example.com/property/exterior.jpg',
'https://storage.example.com/property/living-room.jpg',
],
agentName: 'Bimpe Adeyemi',
agentPhone: '+2348012345678',
});
console.log(result.url);
result = client.pdf.property_flyer(
title="Luxury 3-Bedroom Apartment",
address="15 Admiralty Way, Lekki Phase 1, Lagos",
price=4500000,
currency="NGN",
bedrooms=3,
bathrooms=2,
features=["Swimming pool", "Gym", "24hr power", "Secure parking"],
images=[
"https://storage.example.com/property/exterior.jpg",
"https://storage.example.com/property/living-room.jpg",
],
agent_name="Bimpe Adeyemi",
agent_phone="+2348012345678",
)
result, err := client.Pdf.PropertyFlyer(map[string]interface{}{
"title": "Luxury 3-Bedroom Apartment",
"address": "15 Admiralty Way, Lekki Phase 1, Lagos",
"price": 4500000,
"currency": "NGN",
"bedrooms": 3,
"bathrooms": 2,
"features": []string{"Swimming pool", "Gym", "24hr power", "Secure parking"},
"images": []string{
"https://storage.example.com/property/exterior.jpg",
"https://storage.example.com/property/living-room.jpg",
},
"agentName": "Bimpe Adeyemi",
"agentPhone": "+2348012345678",
})
Rasterize a PDF page
Convert one page of a base64-encoded PDF into a JPEG or PNG image — for example, to show a downloadable preview of an invoice PDF without shipping a PDF renderer in your own app.
const result = await client.pdf.rasterize({
pdfBase64: '<base64-encoded PDF, <=10MB decoded>',
format: 'jpeg',
page: 1, // optional, defaults to 1
dpi: 150, // optional, defaults to 150, clamped server-side to [1, 300]
});
console.log(result.imageBase64); // base64-encoded JPEG/PNG
console.log(result.contentType); // "image/jpeg" | "image/png"
console.log(result.width, result.height); // rendered pixel dimensions
console.log(result.pageCount); // total pages in the source PDF
result = client.pdf.rasterize(
pdf_base64="<base64-encoded PDF, <=10MB decoded>",
format="jpeg",
page=1, # optional, defaults to 1
dpi=150, # optional, defaults to 150, clamped server-side to [1, 300]
)
print(result["imageBase64"])
print(result["contentType"])
print(result["width"], result["height"])
print(result["pageCount"])
result, err := client.Pdf.Rasterize(platformxe.RasterizePdfInput{
PdfBase64: "<base64-encoded PDF, <=10MB decoded>",
Format: "jpeg",
Page: 1, // optional, zero value omits the field — server defaults to page 1
DPI: 150, // optional, zero value omits the field — server defaults to 150, clamps to [1, 300]
})
fmt.Println(result.ImageBase64)
fmt.Println(result.ContentType)
fmt.Println(result.Width, result.Height)
fmt.Println(result.PageCount)
The source PDF is limited to 10MB decoded and 20 pages; the rendered image is capped at 6000px per side. Requests are limited to 200/hr per API key (scope pdf:rasterize) — see Error responses for the full list of status codes, including 408 on a render timeout.
Processor configuration
Get processor config
const config = await client.pdf.getProcessor();
config = client.pdf.get_processor()
config, err := client.Pdf.GetProcessor()
Update processor config
Configure PDF rendering options such as page size, margins, and header/footer templates.
const updated = await client.pdf.updateProcessor({
enabled: true,
config: {
defaultPageSize: 'A4',
defaultMargins: { top: 20, right: 15, bottom: 20, left: 15 },
headerTemplate: '<div style="font-size:10px;">Caldera Properties</div>',
},
});
updated = client.pdf.update_processor(
enabled=True,
config={
"defaultPageSize": "A4",
"defaultMargins": {"top": 20, "right": 15, "bottom": 20, "left": 15},
},
)
updated, err := client.Pdf.UpdateProcessor(map[string]interface{}{
"enabled": true,
"config": map[string]interface{}{
"defaultPageSize": "A4",
"defaultMargins": map[string]interface{}{"top": 20, "right": 15, "bottom": 20, "left": 15},
},
})
Generated PDFs are stored temporarily. Download URLs are signed and expire after 1 hour. For long-term storage, download the file and upload it to your storage service or use the PlatformXe documents API.
Scopes required
| Method | Scope | Rate limit |
|---|---|---|
pdf.offerLetter() | templates:read | Default (1,000/hr) |
pdf.propertyFlyer() | templates:read | Default (1,000/hr) |
pdf.rasterize() | pdf:rasterize | 200/hr |
pdf.getProcessor() | templates:read | Default (1,000/hr) |
pdf.updateProcessor() | templates:write | Default (1,000/hr) |