you've ever deployed a PDF-generating app to a Linux Docker container, you know this feeling:
System.Drawing.Common is not supported on this platform
Fonts turning into squares. Alpine images bloating to 800MB. Hours lost on libgdiplus configs that work locally and break in CI/CD.
I got tired of it. So I built SwiftInvoice — a stateless API that turns JSON into print-ready PDFs. You POST the data, you get a binary PDF stream back. No local dependencies. No font hell.
Here's what it generates:
Three languages, three currencies, native PIX QR Code generation — all from the same endpoint.
Before vs. After
Before:
dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0
RUN apt-get update && apt-get install -y \
libgdiplus libx11-6 fontconfig \
&& ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
After:
dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
# That's it. SwiftInvoice handles the rest.
Quick start (Node.js):
javascript
const response = await axios.request({
method: 'POST',
url: 'https://swiftinvoice.p.rapidapi.com/GenerateInvoice',
headers: {
'X-RapidAPI-Key': 'YOUR_KEY',
'X-RapidAPI-Host': 'swiftinvoice.p.rapidapi.com'
},
data: {
InvoiceNumber: "2026-001",
Language: "pt-BR",
Currency: "BRL",
PixKey: "your-pix-key@email.com", // Generates QR Code automatically
Items: [
{ Description: "API Development", Quantity: 1, UnitPrice: 4500.00 }
]
},
responseType: 'arraybuffer'
});
Full examples in C#, Python, PHP and Go available in the repository.
Free tier available — no credit card required. If you're tired of PDF dependency hell, give it a try.
How are you handling PDF generation in your stack? Still using local libraries?
Top comments (2)
The libgdiplus Alpine saga is exactly why I ended up going a different direction — HTML-in, PDF-out via Playwright, no native dependencies at all. The Docker image stays clean and CSS rendering is accurate because it's an actual browser under the hood.
We built snapapi.pics with that approach — same stateless POST-and-get-PDF concept but it renders HTML instead of JSON. Different tradeoff: you style your invoice as an HTML template instead of defining a JSON schema.
The PIX QR Code generation is a nice native touch — that's something a pure HTML→PDF approach would need to solve separately. Did you end up generating the QR image server-side and embedding it as a data URI, or is that handled by the PDF library itself?
Great point about the Alpine/libgdiplus saga! I chose the JSON-to-PDF path specifically to avoid the overhead of running a headless browser in a serverless environment (Azure Functions), keeping cold starts and memory usage to a minimum.
Regarding the PIX QR Code: It's generated server-side. I use a C# library to generate the QR Code byte array from the PIX payload and then embed it directly into the QuestPDF document structure as an image. This way, the client doesn't have to worry about data URIs or external image hosting — the 'ready-to-pay' logic is baked into the binary stream.