# PDF Verification in the AI Job Search Tool: LaTeX Compilation and ATS Compliance

> Ensure your job applications are ATS compliant. Our AI tool verifies PDFs by compiling LaTeX, checking page counts, and validating readability for maximum success.

- Repository: [Mads Lorentzen/ai-job-search](https://github.com/MadsLorentzen/ai-job-search)
- Tags: deep-dive
- Published: 2026-07-09

---

**PDF verification is a mandatory quality-control gate that compiles LaTeX templates with engine-specific commands, enforces strict page-count limits, and validates ATS readability before marking job application documents as complete.**

The `MadsLorentzen/ai-job-search` repository automates the creation of tailored CVs and cover letters using structured LaTeX templates. Before these documents are presented to users, the tool executes a rigorous **PDF verification** process defined in the repository's [`CLAUDE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/CLAUDE.md) file to ensure professional formatting and machine readability.

## LaTeX Compilation Engine Requirements

PDF verification begins with **engine-specific compilation** of the LaTeX source files. The [cv/main_example.tex](https://github.com/MadsLorentzen/ai-job-search/blob/master/cv/main_example.tex) template must be compiled with **lualatex**, while the [cover_letters/cover_example.tex](https://github.com/MadsLorentzen/ai-job-search/blob/master/cover_letters/cover_example.tex) template requires **xelatex**. This distinction exists because the templates rely on advanced font handling via `fontspec` and `fontawesome5` packages that behave differently across engines. Using the wrong engine results in font substitution errors or missing icons, causing immediate verification failure.

## Page Count and Layout Enforcement

The verification process enforces **strict pagination rules**: the CV must be exactly **2 pages**, and the cover letter must be exactly **1 page**. To prevent **orphaned entries**—where a `\cventry` title appears at the bottom of a page with its bullet points on the next—the template uses `\needspace{5\baselineskip}` before each entry. If a section nears the footer, the compiler may apply `\enlargethispage{2-3\baselineskip}` to absorb overflow and maintain the mandatory page count. Any document exceeding these limits is rejected and flagged for content reduction.

## Typography Consistency Checks

Consistency in the cover letter's bullet list typography is mechanically enforced. The [cover_letters/cover_example.tex](https://github.com/MadsLorentzen/ai-job-search/blob/master/cover_letters/cover_example.tex) file wraps bullet content in a `\lettercontent{}` block that explicitly selects **Raleway-Medium** at 11pt to match the body text. Verification fails if the font family or size deviates from the template specification, as this breaks the visual uniformity required for professional applications.

## ATS Readability Validation

Beyond visual inspection, PDF verification validates **ATS (Applicant Tracking System) readability**. The tool extracts the PDF's text layer using `pdftotext -layout` to verify that contact details appear as literal text, not as images or CID markers. The check specifically hunts for Unicode replacement characters (``) or garbled glyphs that would prevent parsing. The reading order must match the visual layout, ensuring that software scanners ingest the candidate's qualifications correctly.

## Manual Verification Commands

Developers can replicate the verification pipeline locally using the following commands. These snippets compile the sources and perform the ATS text-layer extraction defined in the [CLAUDE.md](https://github.com/MadsLorentzen/ai-job-search/blob/master/CLAUDE.md) verification checklist.

Compile the CV with the required engine:

```bash
cd cv
lualatex main_example.tex

```

Compile the cover letter:

```bash
cd ../cover_letters
xelatex cover_example.tex

```

Perform the ATS readability check:

```bash

# Extract text layer to verify no stray characters or CID markers

pdftotext -layout cv/main_example.pdf - | less
pdftotext -layout cover_letters/cover_example.pdf - | less

```

The following LaTeX snippet from the cover letter template demonstrates the required font specification for bullet lists:

```latex
\lettercontent{%
  {\raggedright\fontspec[Path = OpenFonts/fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{13pt}\selectfont
    \begin{itemize}
      \item Designed scalable data pipelines using Apache Beam.
      \item Optimized ETL workloads, reducing runtime by 30\%.
    \end{itemize}
  \par}
}

```

## Summary

- **PDF verification** is a pass/fail gate defined in [`CLAUDE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/CLAUDE.md) that ensures job application documents meet professional standards before completion.
- **Engine-specific compilation** requires `lualatex` for CVs and `xelatex` for cover letters to handle custom fonts correctly.
- **Strict page limits** enforce exactly 2 pages for CVs and 1 page for cover letters, with `\needspace` and `\enlargethispage` preventing orphaned entries.
- **ATS validation** uses `pdftotext` to confirm the PDF contains parseable text without Unicode replacement characters or CID markers.
- **Typography consistency** mandates Raleway-Medium font for cover letter bullet lists to maintain visual uniformity.

## Frequently Asked Questions

### Why does the CV use lualatex while the cover letter uses xelatex?

The CV template in `cv/main_example.tex` relies on `lualatex` for its superior handling of complex font metrics and micro-typography, while the cover letter in `cover_letters/cover_example.tex` uses `xelatex` to properly render `fontawesome5` icons and `fontspec` configurations. Using the incorrect engine results in compilation errors or missing visual elements, causing the verification to fail.

### What happens if my CV exceeds 2 pages during PDF verification?

Any document violating the page-count requirements—2 pages for the CV and 1 page for the cover letter—is automatically rejected. The verification process treats pagination as a hard constraint; you must reduce content or adjust `\enlargethispage` parameters until the document complies before it can be marked complete.

### How does the tool check ATS compatibility?

The tool extracts the text layer using `pdftotext -layout` and inspects the output for literal contact information, proper reading order, and the absence of Unicode replacement characters (``) or CID markers. This ensures that applicant-tracking systems can parse the document content correctly rather than treating it as an image or corrupted text.

### Where is the PDF verification checklist defined?

The complete verification protocol is documented in the [CLAUDE.md](https://github.com/MadsLorentzen/ai-job-search/blob/master/CLAUDE.md) file at the repository root. This file specifies the compilation commands, page limits, typographic requirements, and ATS validation steps that constitute the mandatory PDF verification process.