DEV Community

Cover image for Building a Resume Editor That Exports Real Text: A4 Layout, Vector PDFs and DOCX
Sadguru
Sadguru

Posted on Originally published at pagewise.sadguruchenu.in AI-assisted

Building a Resume Editor That Exports Real Text: A4 Layout, Vector PDFs and DOCX

On paper, building a resume editor sounds like a weekend project.

You throw together a two-column layout: form inputs on the left, a live preview on the right, and a shiny "Download PDF" button up top. Simple, right?

Except it almost never is.

The moment a user actually relies on your tool to apply for a job, expectations skyrocket. They expect the exported file to mirror the on-screen preview pixel for pixel. They expect it to fit neatly onto standard A4 paper without awkward blank gaps. They want the typography intact. And most importantly: they expect the output to be a living, breathing document—one with selectable, copyable text that applicant tracking systems (ATS) can actually parse, and maybe even a Word (.docx) file they can tweak later.

While building Pagewise, I quickly realized a fundamental truth that reshaped how I approached the entire architecture:

A document that looks great in a web browser isn’t guaranteed to survive printing, PDF parsing, or external word processors.

Most web tools take the easy way out and treat resumes like glorified screenshots. We wanted Pagewise to treat a resume as a real document.

Here is how we tackled the engineering headaches behind making that happen.


1. The A4 Problem: A Browser Is Not a Sheet of Paper

Web browsers are built for fluid, responsive layouts. Documents are the exact opposite they are strictly bound by physical dimensions.

An A4 page is strictly:

  • Width: 210 mm
  • Height: 297 mm

When you design a document editor purely using pixels or viewport percentages, you set yourself up for heartbreak. A layout might look gorgeous on a 1440p monitor, but the second the user tries to print or export it, things fall apart:

  • Browser print drivers apply arbitrary scaling.
  • Default margins eat away at your layout.
  • Sections awkwardly break right across the middle of a job title.
  • Content spills over onto a practically empty second page.

To solve this, we had to stop treating the canvas like a responsive webpage and start treating it as a physical medium.

Our CSS establishes a rigid document boundary matching real-world paper dimensions:

.resume-page {
  width: 210mm;
  min-height: 297mm;
  box-sizing: border-box;
  position: relative;
  background: #ffffff;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }
  .resume-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    box-shadow: none;
  }
}
Enter fullscreen mode Exit fullscreen mode

Note: This is a simplified snippet, but it highlights the core mindset shift.

Of course, CSS dimensions alone don’t magically solve pagination. When a user writes a lengthy work history, handling dynamic overflow without severing bullet points mid-sentence requires active content measurement and calculated page breaks.


2. Typography Is Document Geometry, Not Just Decoration

One of the sneakiest bugs we ran into had nothing to do with margins or flexbox it was fonts.

In web design, a font change is mostly cosmetic. In fixed-geometry document design, fonts dictate layout math.

A subtle change in font weight, letter spacing, or line height can:

  • Alter exact line-wrapping points.
  • Expand a 2-line bullet point into 3 lines.
  • Increase section height by just 4 pixels... pushing an entire section onto an unwanted second page.

This becomes a nightmare when your frontend preview uses local system fonts or Google Fonts, while your backend PDF engine runs on a Linux server that has neither. When the server falls back to standard Helvetica or DejaVu Sans, your carefully calibrated single-page resume suddenly bleeds into page two.

Our Font Normalization Matrix

To combat this, we set up a controlled normalization strategy. Whenever a user picks a common font, our pipeline pairs it with verified, metrically close open-source equivalents across environments:

Requested Font Normalized / Open-Source Equivalent
Georgia Lora / Liberation Serif
Arial Arimo
Calibri Carlito

Are they 100% identical down to the sub-pixel kerning pair in every environment? No. But this controlled mapping drastically reduces surprise layout shifts.

The takeaway: If typography shifts between preview and export, your document geometry breaks. Font consistency must be treated as an infrastructure problem.


3. The "Canvas Trap": Why We Refused to Flatten to Images

If you look at how many modern web apps generate PDFs, you'll see a very common shortcut:

  1. Run html2canvas to take a screenshot of the DOM.
  2. Slap that raster image inside a jsPDF wrapper.
  3. Call it a day.

It looks identical to the preview! It’s fast to build!

And it produces a terrible resume.

When you turn a document into a flat picture, you destroy its utility:

Screenshot / Canvas PDF True Vector & Text PDF
Text is baked into flat pixels Text remains sharp, selectable, and highlightable
Copy-pasting text is impossible Recruiters can easily copy contact info or bullet points
ATS parsers fail or require messy OCR ATS software reads native text streams directly
Blurry when zoomed in or printed Crisp vector rendering at any scale
Zero screen-reader accessibility Screen-reader friendly

Imagine a recruiter trying to copy your email or phone number from a resume, only to find they're clicking on a JPEG. Or worse, an automated ATS pipeline rejecting your application because it couldn't extract a single keyword from an image.

At Pagewise, we committed to true vector text. When you download a PDF, the text remains real, selectable text. While no format can guarantee 100% compatibility across every single outdated ATS parser in existence, outputting real text gives candidates the best possible shot.


4. One Data Model, Two Completely Different Export Paths

People don’t just want PDFs. A huge chunk of users still need an editable Microsoft Word (.docx) file—whether to submit through job portals that require it or to make custom adjustments for a specific application.

The naive solution would be trying to convert the rendered HTML into Word, or exporting an image into a DOCX file. Both create a mess.

Instead, we decoupled our document state from our rendering targets. A single JSON resume model feeds into an export dispatcher with two dedicated pipelines:
┌────────────────────────┐
│ Resume Document Model │
└───────────┬────────────┘
│
Export Dispatcher
/ \
/ \
v v
┌─────────────────┐ ┌─────────────────┐
│ Visual Pipeline │ │ python-docx │
│ (Vector PDF) │ │ (XML-level) │
└────────┬────────┘ └────────┬────────┘
│ │
v v
┌─────────────────┐ ┌─────────────────┐
│ Sharp, ATS-ready│ │ Native Editable │
│ PDF Document │ │ Word Styles │
└─────────────────┘ └─────────────────┘

  • Path A (Visual PDF): Renders the document model through a headless browser environment configured with strict print stylesheets, generating real text, vector borders, and predictable page breaks.
  • Path B (Native DOCX): Feeds the raw structured data into python-docx. Instead of hacking HTML tags into Word, it builds real Word paragraphs, native headings, real bullet lists, and genuine XML table structures.

This means when a user opens the .docx file in Microsoft Word, they aren’t fighting broken floating textboxes or glued-together layouts—they get a clean, standard Word document styled with native typography.


5. The Hard Reality: Document Fidelity Is an Ongoing Battle

Does having a single data model magically solve every cross-format inconsistency?

Honestly? No.

Word and web browsers use fundamentally different layout engines. Word calculates line wraps, margin collapse, and paragraph spacing under its own rules.

A layout that comfortably leaves 15mm of breathing room at the bottom of an A4 PDF might push the last bullet point onto page two in Microsoft Word. A header accent bar that looks sleek in CSS requires a careful table border hack in DOCX XML.

Maintaining parity between on-screen previews, generated PDFs, and native Word documents isn’t a one-and-done feature. It’s an ongoing process of calibrating margins, tuning line heights, and testing edge cases.


6. What Building This Taught Us

Building Pagewise forced us to look past the surface of web UI and think deeply about document architecture.

A resilient document editor has to separate three distinct layers:

  1. Content: The raw data (your jobs, dates, skills, metrics).
  2. Presentation: How that data looks right now on the screen.
  3. Target Output: How that data must behave inside an external ecosystem (A4 paper, Adobe Acrobat, Word, ATS scanners).

When you keep those concerns clean and distinct, the system stops being a fragile hack and starts behaving like a real document engine.


What's Next?

We're continuing to refine Pagewise’s rendering engine to make multi-page handling and layout customization even smoother. Alongside the document pipeline, we've also introduced Wiser AI a companion tool that helps analyze job descriptions, flag missing skills, and suggest targeted resume improvements without taking away user control.

If you want to see how the editor works in practice (or test the exports yourself), check it out here:
👉 Pagewise


Let's Chat

If you’ve built document editors, invoice generators, or report exporters:

  • How do you bridge the gap between browser DOM previews and print/export parity?
  • Do you use headless browser rendering, native PDF libraries, or something else entirely?

I'd love to hear how other teams handle this in the comments!

Top comments (0)