DEV Community

Andrea Lima
Andrea Lima

Posted on

Stop Fighting PDF Generation: How I Built a Stateless API for Global Invoices

Generating professional PDFs in the backend is a notorious headache. If you've ever dealt with:

❌ Broken layouts when moving from Dev to Docker/Linux.

❌ Missing fonts or "libgdiplus" issues on the server.

❌ Complexity in localizing currencies, dates, and taxes.

❌ Generating QR Codes (like PIX) dynamically inside the document.

...then you know the struggle.

The Solution: A Stateless Approach
I decided to build SwiftInvoice, a high-performance API designed to handle the "boring parts" of billing. Instead of installing heavy engines on your main server, you just send a JSON and get a print-ready PDF stream back.

Why this matters for your architecture:
Serverless Ready: Since it's stateless, you don't store anything. Perfect for clean, scalable microservices.

Native Localization: It handles English, Portuguese, and Spanish formatting (culture-aware) automatically.

High Performance: Built on .NET/Azure, it maintains a 100% service level for critical billing tasks.

Quick Example (Node.js/Axios):

JavaScript
const response = await axios.post('https://swiftinvoice.p.rapidapi.com/GenerateInvoice', {
    InvoiceNumber: "2026-001",
    SenderName: "Your Startup",
    PixKey: "your-pix-key", // Native PIX support!
    Items: [{ Description: "API Subscription", Quantity: 1, UnitPrice: 25.00 }]
}, { responseType: 'arraybuffer', headers: { 'X-RapidAPI-Key': 'YOUR_KEY' } });
Enter fullscreen mode Exit fullscreen mode

Try it out
I've just released it on RapidAPI with a Free Basic Tier for the community to test and integrate into their side projects.

👉 Check the Playground: swiftinvoice

I’d love to hear your feedback: What’s your biggest pain point when generating reports or invoices today?

Top comments (0)