Inkspan › Next.js
Call the Inkspan /v1/generate/template endpoint from Next.js to generate a PDF from a template — no headless browser, fonts, or PDF infrastructure to maintain. Set your API key as an environment variable and POST.
// app/api/pdf/route.ts
export async function POST() {
const res = await fetch('https://api.inkspan.dev/v1/generate/template', {
method: 'POST',
headers: { 'X-API-Key': process.env.INKSPAN_KEY!, 'Content-Type': 'application/json' },
body: JSON.stringify({"template":"<h1>{{name}}</h1>","data":{"name":"Ada"}}),
});
return new Response(await res.arrayBuffer(), { headers: { 'Content-Type': 'application/pdf' } });
}
Get a free API key →