Iurii RoguliaIurii Rogulia
AboutAI EngineeringServicesProjectsAI SkillsStackTestimonialsPhrasesBlog
Contact
Iurii Ships.

Iurii Rogulia, Senior Agentic AI & Full-Stack Software Engineer. Professionally building software since 2001.

ChecklistsPrivacy PolicyCookie Policy
Just for fun:Think of a numberThink of a birthday

Business

TMI Iurii Rogulia
VAT ID: FI29845875
DUNS: 368664211
Lappeenranta, Finland 🇫🇮

  1. /
  2. Projects
  3. /
  4. pi-pi.ee – i18n B2B Presentation PDF Generator

Iurii Generates: pi-pi.ee – i18n B2B Presentation PDF Generator

March 4, 2026

On-demand PDF sales presentation in 28 languages – one codebase, one URL pattern. Rendered per request by a Next.js route handler, nothing stored.

Live Demo

Stack

Next.jsReactTypeScriptNode.js

Libraries

next-intlreact-pdf

Topics

B2BDocument AutomationHTTP Cachingi18nPDF

Key Results

  • Reach prospects in their own language – a ready sales deck in any of 28 languages, with zero manual work per language
  • Sales share one link – no translating, reformatting or exporting a slide deck per prospect
  • Decks are never out of date – product names, descriptions and material data come from the site’s own message files
  • No translator cost – content comes straight from the site’s existing message files
  • Nothing new to run or pay for – the PDF is generated on demand, no storage or queue
pi-pi.ee – i18n B2B Presentation PDF Generator

The Business Problem

The pi-pi.ee sales team sells waterless urinal systems across Europe. Reaching distributors and facility managers means communicating in their language – and that communication starts with a product presentation.

The existing workflow: a single PowerPoint file, maintained manually, in one language. When the sales team needed to send a deck to a prospect in Poland or Estonia, someone had to translate it, reformat it, and export it to PDF. Each iteration of the product – new prices, updated specs, different material grades – required the same process all over again. With 28 languages to cover, the problem was structurally unsolvable with manual tooling.

The core requirements:

  1. 28 locales – same layout and branding across all markets, each in the local language
  2. Shareable link – pi-pi.ee/en/presentation.pdf, pi-pi.ee/et/presentation.pdf, pi-pi.ee/de/presentation.pdf opens directly in the browser; no login, no form, no download page
  3. Always in sync – content lives in the site’s own i18n files; update product texts or material data on the site, and the presentation picks them up
  4. Zero infrastructure overhead – no storage buckets, no generation queues, no separate CMS

The Solution

I built a Next.js App Router route handler at /[locale]/presentation.pdf that generates the PDF on demand and returns it in the HTTP response. The key architectural decision: the presentation reads the site’s own message files – a small dedicated presentation namespace for the slide copy, plus the product, material and about texts that the website already uses – so there is no separate CMS and no per-deck translation work.

The PDF is assembled with @react-pdf/renderer – React components describe the layout declaratively, and the whole document is rendered to an in-memory buffer on the server. No file is saved to disk, and nothing is uploaded to a storage bucket: the PDF exists only for the duration of the request. The response carries Cache-Control: public, max-age=86400, so a repeat open of the same link can be served from cache for up to a day.

Slide Structure

The presentation is four A4 pages, each with a distinct purpose:

Slide 1 – Cover. Company logo, tagline, a short subtitle, company details (name, VAT ID, website, email), and two product photos.

Slide 2 – Range overview. Every active urinal and sink from the product data, each with a photo, name, and summary taken from the site’s product texts, followed by the available colours with their RAL codes.

Slide 3 – LLDPE Material. Four stat cards (mounting, temperature range, wall thickness, product weight), followed by a comparison table of LLDPE versus polypropylene.

Slide 4 – Manufacturer. Six cards on why buyers choose Pi-Pi as their manufacturer: logistics, history, batch quality control, minimum order, custom colour, and sample cost. Three of them take their text from the site’s about messages.

Results

The presentation is live at pi-pi.ee/[locale]/presentation.pdf for all 28 locales. B2B managers now share a single URL in their outreach emails. The recipient gets a formatted presentation in their language – with product texts and material data that come from the live site – without any manual preparation or translator involvement.

MetricValue
Locales28
Storage requiredNone – generated on demand
Translators involvedZero – reads the site’s message files
Content syncAutomatic on each deploy
DeploymentSelf-hosted Next.js (Coolify, standalone build)

Under the Hood

For the technically curious, here is how the core pieces are built.

Route Handler – Generate and Return

The route reads the locale from the URL, returns 404 for a locale the site does not support, loads the message files for that locale, renders the PresentationDocument component tree into a buffer, and returns the bytes in the response:

// src/app/[locale]/presentation.pdf/route.ts
const { locale } = await params;
if (!isSupportedLocale(locale)) {
  return new NextResponse(null, { status: 404 });
}
const buffer = await generatePresentationPDF(locale);
 
return new NextResponse(new Uint8Array(buffer), {
  headers: {
    "Content-Type": "application/pdf",
    "Content-Disposition": `inline; filename="pi-pi-presentation-${locale}.pdf"`,
    "Cache-Control": "public, max-age=86400",
    "X-Robots-Tag": "noindex, nofollow",
  },
});
 
// src/lib/pdf/generate-presentation.ts
const pdfBuffer = await renderToBuffer(
  PresentationDocument({ messages, overviewProducts, lldpeSlide, aboutTexts /* … */ })
);

No PDF is saved to disk and none is uploaded to a storage bucket. The X-Robots-Tag header keeps the generated files out of search results.

Reusing Site Message Files

The generator reads the same src/messages tree the site uses. Slide copy comes from a dedicated presentation namespace, and the product names, summaries, LLDPE data and about texts come from the main locale files, so there is no separate content system for the deck:

// src/lib/pdf/messages.ts
const filePath = join(process.cwd(), "src", "messages", subdir, `${locale}.json`);
 
// src/lib/pdf/generate-presentation.ts
const presentationRaw = getPresentationMessages(locale); // messages/presentation/{locale}.json
const mainMessages = getMessages(locale); // messages/{locale}.json

When the site’s product texts or material data change, the next deploy carries them into the PDF for every locale; there is no separate deck to edit.

Non-Latin Fonts and Hyphenation

@react-pdf/renderer uses its own text rendering engine and does not inherit system fonts or browser fonts. Without explicit font registration, any character outside the Latin-1 range renders as an empty rectangle. The fix is to register a full Unicode font with an explicit CDN URL before the document renders:

// src/lib/pdf/theme.tsx
Font.register({
  family: "Roboto",
  fonts: [
    { src: "https://fonts.gstatic.com/.../Roboto-Regular.ttf", fontWeight: 400 },
    { src: "https://fonts.gstatic.com/.../Roboto-Bold.ttf", fontWeight: 700 },
  ],
});
 
// Disable automatic hyphenation globally.
// The built-in algorithm is English-only — applied to non-Latin locales
// it produces incorrect line breaks mid-word.
Font.registerHyphenationCallback((word) => [word]);

The hyphenation callback is the less obvious one: @react-pdf/renderer runs a hyphenation pass on every text node by default. For non-English locales this produces broken line breaks. Returning [word] as a single-element array tells the engine to never split the word, which gives correct results for all 28 locales at once.

Stale Module Cache in Development

Because the presentation reads from the same i18n JSON files as the rest of the site, hot-reload should work automatically – edit a message, refresh the PDF URL, see the change. In practice, the PDF route kept parsed message objects in a module-level Map. The cache survived Next.js hot-reload, so edits to JSON files had no effect until a full server restart.

The fix is a single environment check:

// src/lib/pdf/messages.ts
const IS_DEV = process.env.NODE_ENV === "development";
const messagesCache = new Map<string, Record<string, unknown>>();
 
const cached = messagesCache.get(cacheKey);
if (!IS_DEV && cached) {
  return cached;
}
// … read and parse the JSON file from disk …
if (!IS_DEV) {
  messagesCache.set(cacheKey, messages);
}

In development, the cache is bypassed entirely – every request re-reads the JSON from disk. In production the cache lives for the lifetime of the server process, which is the desired behaviour: repeated requests avoid redundant file reads.

Iurii RoguliaAvailable

Need something similar?

I build custom solutions – from APIs to full products. Let’s talk about your project.

View all projects

Related projects

pi-pi.ee – B2B E-commerce for Waterless Urinal Systems
pi-pi.ee – B2B E-commerce for Waterless Urinal Systems
January 17, 2026
pi-pi.ee – B2B E-commerce for Waterless Urinal Systems

i18n B2B e-commerce platform for waterless urinal products across 32 European countries with automated VAT handling, PDF invoicing, and CRM integration.

Stack

Next.jsReactTypeScriptNode.jsTailwind CSSNixpacks

Databases

NotionRedis
pi-pi.ee – B2B Deal & Document Portal
pi-pi.ee – B2B Deal & Document Portal
July 1, 2026
pi-pi.ee – B2B Deal & Document Portal

Internal sales portal that turns a wholesale deal into its full trade paperwork from one form: pro forma, contract, commercial invoice, packing list, CMR.

Stack

Next.jsReactTypeScriptNode.jsTailwind CSS

Databases

Notion

Related posts

Batch PDF Generation in Node.js Without Running Out of Memory
August 12, 2026· 9 min
Batch PDF Generation in Node.js Without Running Out of Memory

Batch PDF generation in Node.js without OOM: concurrency limits, back-pressure, releasing renderers between docs, and why Promise.all(map) fails at scale.

Stack

Node.jsTypeScript
React Email + Resend Tutorial: Transactional Emails with PDF Invoices
April 5, 2026· 13 min
React Email + Resend Tutorial: Transactional Emails with PDF Invoices

Production transactional emails with React Email and Resend: PDF invoices via react-pdf, Vercel Blob temporary storage, and BullMQ Stripe webhooks.

Stack

Next.jsTypeScriptReact