Add Header and Footer to PDF Online: Dynamic Variables, Multi-Column Stamping & In-Browser PDF-Lib
⚡How to Add Headers and Footers to a PDF in 4 Steps
1. Import Your PDF Document
Select or drag and drop your PDF into the secure workspace. The file is processed locally in browser RAM with zero server uploads.
2. Configure Header & Footer Zones
Enter your desired text in the six layout zones. Use dynamic macros like `{page}`, `{total}`, and `{date}` for automated metadata.
3. Set Margins, Typography & Exclusions
Select font family, size, color, and margin offsets. Check 'Skip First Page' to keep your cover page clean.
4. Apply Framing and Download
Click 'Add Header & Footer' to composite vector text operators into the document streams. Download your finalized publication immediately.
Professional document presentation requires structured header and footer framing. Whether publishing enterprise research papers, corporate annual reports, legal briefs, training manuals, or formal product documentation, headers and footers provide critical organizational context: company branding, document titles, confidentiality classifications, author attribution, dates, and page counts. Without consistent running headers and footers, multi-page documents look unpolished, unbranded, and disjointed when distributed across departments or printed onto physical paper.
Our browser-native Add Header and Footer tool delivers comprehensive, publication-grade document labeling directly inside your browser. Featuring a versatile six-zone layout grid (Left, Center, and Right zones across both Header and Footer bands), dynamic macro variable expansion (`{page}`, `{total}`, `{date}`, `{title}`, `{filename}`), custom font formatting, and cover page exclusions, you can transform plain documents into cohesive enterprise publications in seconds. Operating with 100% client-side privacy via Web Workers and PDF-Lib, your confidential corporate files never touch external cloud servers.
Read the full technical guide
The Anatomy of Professional Headers & Footers: The Six-Zone Grid
In enterprise publishing standards, running headers and footers are divided into distinct functional zones. Professional layout designers rarely place all text in a single block; they distribute metadata logically across the upper and lower margins.
Our tool implements the industry-standard six-zone layout model: Header Left (typically used for document title or section heading), Header Center (used for corporate logos or security classifications like 'CONFIDENTIAL'), Header Right (used for date or department code), Footer Left (used for copyright notices or file names), Footer Center (used for confidentiality notices), and Footer Right (used for dynamic pagination like 'Page X of Y'). Our engine coordinates these zones simultaneously, ensuring balanced visual weighting across every page.
Dynamic Macro Variable Expansion: Automated Metadata Insertion
Manually typing page counts or document titles across dozens of pages is tedious and prone to errors. Our header and footer engine features intelligent macro variable expansion, parsing dynamic placeholder tags in real time during PDF compilation.
Supported macros include `{page}` for current page number, `{total}` for total document page count, `{date}` for current execution date (formatted to ISO standards or local conventions), `{time}` for current timestamp, and `{filename}` for the original uploaded file name. When you enter a string like 'Confidential Document — Page {page} of {total}', our worker dynamically evaluates the macro per page, injecting the calculated text string seamlessly into the page content stream.
Cartesian Coordinate Systems, MediaBox Boundaries & Bleed Offsets
A frequent failure of amateur PDF tools is that headers or footers overlap with existing body text or clip against physical printer margins. In the PDF specification, page dimensions are defined by five distinct box dictionaries: `/MediaBox` (the physical sheet size), `/CropBox` (the displayed visible area), `/BleedBox`, `/TrimBox`, and `/ArtBox`.
Our tool measures the active `/CropBox` of every page, establishing top and bottom margin keep-out zones (typically 36 to 54 points, or 0.5 to 0.75 inches). The engine calculates exact baseline positions relative to the bottom-left coordinate origin `(0, 0)`, ensuring that headers float comfortably in the top margin and footers sit cleanly above the bottom edge without colliding with body paragraphs or charts.
Alternating Recto/Verso Layouts for Commercial Book Binding
When publishing books, manuals, or bound reports intended for double-sided duplex printing, headers and footers must adapt to page parity. On odd-numbered right-hand pages (recto), chapter titles and page numbers belong on the outer right edge. On even-numbered left-hand pages (verso), document titles and page numbers belong on the outer left edge.
Our tool includes dedicated Recto/Verso alternating logic. When enabled, outer header and footer zones swap positions automatically between even and odd pages, ensuring that bound materials present a professional, symmetrical appearance when opened as a two-page spread.
Zero-Knowledge Local Processing: Protecting Proprietary Work Product
Enterprise documents that require running headers and footers are typically proprietary corporate assets: business plans, financial projections, legal contracts, or internal audit findings. Uploading these sensitive assets to third-party web conversion servers introduces severe data leakage risks.
2run.tools operates on a strictly client-side architecture. Powered by WebAssembly and isolated Web Workers, all parsing, text layout calculation, font embedding, and PDF stream serialization take place entirely in your browser's private memory space. Your confidential documents are never transmitted across the internet, ensuring 100% compliance with corporate confidentiality standards.
Font Subsetting, Encoding Systems (WinAnsi vs. Identity-H) & CMap Tables
Injecting dynamic typography into existing PDF documents requires rigorous font encoding management. Under ISO 32000, fonts in a PDF can be encoded using legacy simple encodings (such as StandardEncoding, MacRomanEncoding, or WinAnsiEncoding) or composite Type 0 CIDFonts utilizing Identity-H horizontal CMap tables.
If an injection utility naively writes UTF-8 text into a page stream expecting WinAnsi glyphs, special characters like accented letters, smart quotes, em dashes, or foreign currency symbols turn into garbled 'mojibake' rectangles. Our client-side engine embeds proper WinAnsi and Unicode CMap dictionaries alongside each embedded font descriptor, guaranteeing that international dates, author names, and mathematical symbols render with absolute typographic fidelity.
Selective Page Range Application & Cover Exclusions
First impressions matter. Professional publications never display running headers or footers across the front cover, and executive summaries or title pages often omit headers to maintain visual elegance.
Our tool allows you to exclude the first page with a single toggle, or specify custom page ranges (such as `2-100` or `3-25, 28-50`). You can maintain a pristine, unblemished cover design while enforcing consistent corporate framing across all subsequent pages.
💡Pro Tips for Professional Headers and Footers
- •Use subtle text colors (such as slate gray `#555555`) and modest font sizes (8pt to 10pt) for headers and footers so they provide context without distracting from body content.
- •Add a thin horizontal separator rule beneath the header or above the footer to cleanly demarcate page margins from body paragraphs.
- •Combine `{page}` and `{total}` macros in the footer right zone ('Page {page} of {total}') to guarantee document integrity for formal contracts.
- •Verify your document margins: ensure the header and footer margin settings leave ample clearance so text does not overlap with existing page elements.
- •If you are stamping corporate classification levels (e.g. 'STRICTLY CONFIDENTIAL'), place it centered in the header in bold crimson or dark blue text for maximum visibility.
🛡️WebAssembly Typography & Vector Stream Compositing
Our header and footer engine operates inside a sandboxed Web Worker utilizing WebAssembly-compiled PDF-Lib. For each page, the engine inspects the `/MediaBox` and `/CropBox` dimensions, extracts page rotation transforms, and establishes an isolated graphics state (`q`). It embeds standard PostScript Type 1 font programs or TrueType subsets, measuring glyph advance widths via character metric tables. Text strings are rendered using text positioning operators (`BT`, `Tf`, `Tm`, `Tj`, `ET`), with horizontal offsets calculated to guarantee left, center, or right alignment with mathematical precision before appending the stream to `/Contents`.
Stack: WebAssembly • Multi-threaded Web Workers • HTML5 Canvas API
Privacy: Files never leave your device or touch a cloud buffer; analytics run only with your consent.
Complementary Tools in this Workflow
Chain these client-side utilities together for high-performance creative workflows.
Add Page Numbers
Stamp customizable header or footer page numbers across documents.
Convert Entire PDF to B&W
Save printer toner by converting all text and color photos to clean grayscale.
Crop PDF Page Margins
Trim white margins and printer bleed marks from documents.
Resize Pages to A4 / Letter
Standardize irregular page sizes into consistent A4 or US Letter sheets.