DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
HTML CSS

How to Add Vertical Text to the Right Side of Every wkhtmltopdf Page

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a fixed HTML element rotated with CSS, then reserve right-side margin space and test the generated PDF on several pages. wkhtmltopdf has header and footer features, but its command-line documentation does not provide a dedicated “vertical text on the right edge” switch. For static text, a fixed element in the document is the simplest starting point. If the text must include values such as the current page number, adapt a custom HTML header or footer template and use wkhtmltopdf’s page substitutions.

Choose the implementation route

Your choice depends on whether the label is static and how much control it needs.

Route Best for Important checks
Fixed element in the converted HTML A static label such as “Confidential” that should appear with the document body Verify that it repeats on every page, stays inside the page boundary, and does not overlap body text.
Custom HTML header or footer A label that needs page variables such as [page] or [topage] The documented examples are horizontal; rotation, right-edge geometry, margins and spacing require custom CSS and PDF inspection.

The fixed-element method is the practical first attempt. Header/footer templates are more appropriate when the label changes per page.

Static vertical text with a fixed HTML element

1. Add the label to the source HTML

Place the element in the document being converted. It can be near the start or end of the body; its fixed positioning removes it from normal document flow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
<div class="vertical-text">Confidential</div>

2. Rotate and position it with CSS

.vertical-text {
  position: fixed;
  right: 0;
  top: 50%;
  -webkit-transform: rotate(90deg);
  -webkit-transform-origin: center bottom;
  white-space: nowrap;
}

This follows the commonly suggested wkhtmltopdf technique: a fixed element at the right edge, rotated with the WebKit-prefixed transform supported by wkhtmltopdf’s rendering engine. The exact top, transform origin and offset depend on the label length, paper size and installed wkhtmltopdf build.

3. Reserve room for the label

A label at right: 0 can touch the printable edge or cover body content. Give the document a right margin and move the label into that reserved strip.

@page {
  margin: 18mm 24mm 18mm 18mm;
}

.vertical-text {
  position: fixed;
  right: 6mm;
  top: 50%;
  -webkit-transform: rotate(90deg);
  -webkit-transform-origin: center bottom;
  white-space: nowrap;
  font: 10pt Arial, sans-serif;
}

The larger right margin creates a predictable safety area. If the text still clips, increase the margin or move the element farther inward. Check both the page edge and the body edge: a label can be inside the paper but still overlap paragraphs, tables or images.

4. Convert and inspect more than one page

wkhtmltopdf --margin-right 24mm input.html output.pdf

Open the PDF and inspect the first page, a middle page and the final page. Fixed-position repetition is affected by wkhtmltopdf’s pagination and layout behavior; a result that looks correct on page one is not proof that every page is correct. Test documents with short and long pages, tables that cross page breaks, different fonts and the actual paper size used in production.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Dynamic labels with an HTML header or footer

wkhtmltopdf documents custom HTML headers and footers and substitutions including [page], [frompage] and [topage]. These are useful when the side label must say something such as “Page 3 of 12” or include a changing value.

Create a template

A header or footer template can contain JavaScript that reads the substituted query-string values and writes them into an element. The following template illustrates the structure; the rotation and dimensions are deliberately customized for a right-side label rather than copied from the usual horizontal-header example.

Rank #2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
  • Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
  • Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
  • Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
  • Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
  • Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <style>
    html, body { margin: 0; padding: 0; }
    #side-label {
      position: fixed;
      right: 4mm;
      top: 50mm;
      white-space: nowrap;
      -webkit-transform: rotate(90deg);
      -webkit-transform-origin: right top;
      font: 9pt Arial, sans-serif;
    }
  </style>
</head>
<body>
  <div id="side-label"></div>
  <script>
    function value(name) {
      var query = window.location.search.substring(1).split('&');
      for (var i = 0; i < query.length; i++) {
        var pair = query[i].split('=');
        if (decodeURIComponent(pair[0]) === name)
          return decodeURIComponent(pair[1] || '');
      }
      return '';
    }
    document.getElementById('side-label').textContent =
      'Page ' + value('page') + ' of ' + value('topage');
  </script>
</body>
</html>

Save it as side-footer.html, then pass it to wkhtmltopdf. Use footer options if you want footer rendering semantics; use header options if that better matches your document.

wkhtmltopdf 
  --margin-right 24mm 
  --footer-html side-footer.html 
  --footer-spacing 0 
  input.html output.pdf

The template’s geometry must be tested with your installed build. Header/footer spacing and page margins determine the available area; excessive spacing can place the rendered header or footer outside the page. A rotated template may also need a larger right margin than a normal horizontal footer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the label from clipping the document

Use the page margin as a protected column

Set --margin-right (or the equivalent library setting) wide enough for the rotated label, then place the label within that column. Do not rely on the PDF viewer’s visible edge as a safe boundary: printer margins, paper formats and scaling can differ.

Control the transform origin

-webkit-transform-origin changes the point around which the text rotates. center bottom is a useful starting point for a fixed body element; a header/footer label often needs right top or a measured millimetre offset. If the text swings outside the page after rotation, change the origin before changing the font size.

Prevent wrapping

Use white-space: nowrap. A wrapped label changes its dimensions before rotation and commonly causes unexpected overlap or clipping.

Account for writing direction and reading order

rotate(90deg) makes Latin text read from bottom toward top when viewed along the right edge. If your design requires top-to-bottom reading, try rotate(-90deg) and adjust the origin and offsets. wkhtmltopdf’s older WebKit engine makes visual verification essential.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
  • Create and edit PDFs. Collaborate with ease. E-sign documents and collect signatures. Get everything done in one app, wherever you go.
  • Edit text and images without jumping to another app.
  • E-sign documents or request e-signatures on any device. Recipients don’t need to log in to e-sign.
  • Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
  • Share PDFs for collaboration. Commenting features make it easy for reviewers to comment, mark up, and annotate.

Troubleshooting common failures

The text appears only on the first page

Cause: the element is being laid out as ordinary content, or the installed wkhtmltopdf build handles fixed elements differently around page breaks.

Fix: confirm position: fixed is applied, keep the element outside containers with clipping rules such as overflow: hidden, and test a minimal HTML file. If repetition remains unreliable, move the label into a custom header/footer template and validate that route.

The label is cut off at the right edge

Cause: the rotated bounding box extends beyond the printable page.

Fix: increase the right margin, move the element inward, change -webkit-transform-origin, or reduce the font size. Inspect at the actual paper size rather than a viewer thumbnail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The label overlaps paragraphs or tables

Cause: the body has no reserved side column.

Fix: increase --margin-right and match the CSS right offset to that column. Wide tables may still extend into the margin; constrain their width or revise the table layout.

Page variables are blank

Cause: the template is being opened directly in a browser, or the variable names are not read from the query string.

Rank #4
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
  • Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
  • EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
  • READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
  • CREATE, COMBINE, SCAN and COMPRESS PDFs.
  • FILL forms & Digitally Sign PDFs. Work with Digital certificates

Fix: render it through wkhtmltopdf’s --header-html or --footer-html option, then inspect the template’s URL query string and JavaScript decoding. Test with a simple visible value before adding rotation.

Header or footer content is outside the page

Cause: header/footer spacing or margins are too large for the selected paper size.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: reduce spacing, increase the relevant page margin, or move the label’s fixed coordinates. Keep the total of margins and spacing within the page’s printable area.

The result differs between machines

Cause: wkhtmltopdf packages can use different Qt/WebKit builds, fonts and command-line defaults.

Fix: pin the wkhtmltopdf version in your build environment, install the same fonts, and keep a regression PDF containing short pages, long pages and page breaks. Compare rendered output, not only exit codes.

Operational and performance considerations

  • Rendering cost: a fixed text node adds little work, while a complex header/footer template introduces another HTML rendering path and JavaScript execution.
  • Reliability: avoid animations, asynchronous font loading and layout-dependent JavaScript in the label. A deterministic font and fixed dimensions are easier to reproduce.
  • Pagination: test long tables, images and explicit page breaks because pagination can expose overlap that is invisible in a short sample.
  • Accessibility: rotated decorative text may be read in an unexpected order by PDF assistive technology. If it conveys essential information, also provide that information in normal document text.
  • Output validation: check page count, label presence, clipping and overlap in an automated PDF review step where the document is business-critical.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your actual requirement is to capture a clean website screenshot or PDF without maintaining a browser pipeline, ScreenshotNeo provides a one-request API and an MCP server for AI clients. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its options include custom CSS and JavaScript, full-page capture, PDF settings, device and viewport controls, waits, request blocking, authentication headers, cookies, geolocation, caching, signed links, asynchronous jobs and bulk capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a direct capture, see the ScreenshotNeo API documentation:

Best Value
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
  • ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
  • MAXIMUM FUNCIONALITY – create interactive forms, compare PDFs, bates numbering, find and replace text or colors, convert documents, OCR engine, comment, highlight, fill out and print forms, document protection and others
  • EASY TO INSTALL AND USE – well-structured user-interface, in-program instructions, free tech support whenever you need it
  • GREAT VALUE FOR MONEY - why spend a fortune if you can have maximum functionality at a reasonable price - this also fits the requirements of companies very well
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

An MCP server lets Claude, Cursor and other MCP clients call screenshot, page-info and PDF tools. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Frequently asked questions

Does wkhtmltopdf have a vertical-right-text command-line option?

No dedicated option is documented. The effect is built with HTML/CSS positioning or by adapting a custom header/footer template.

Should I use a header or a fixed body element?

Use a fixed body element for static text. Use a header/footer template when page variables or separate rendering control are required.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why must I test several pages?

Fixed-element repetition and rotated geometry can vary with pagination, content length and wkhtmltopdf builds. A single-page test cannot reveal those failures.

Frequently Asked Questions

Can I place the text on the left instead?

Yes. Change the horizontal offset from right to left, reserve left margin space, and rework the transform origin for the new edge.

Will this work for every paper size automatically?

Not without testing. Paper dimensions, margins and label length change the rotated bounding box, so validate each production format.

Quick Recap

Bestseller No. 1
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
Bestseller No. 2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.; Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
$99.99
Bestseller No. 3
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
Adobe Acrobat Pro | PDF Software | Convert, Edit, E-Sign, Protect | PC/Mac Online Code | Activation Required
Edit text and images without jumping to another app.; Convert PDFs to editable Microsoft Word, Excel, or PowerPoint documents.
$239.88
Bestseller No. 4
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
PDF Extra Lifetime - Professional PDF Editor - Best Adobe Acrobat Pro Alternative - Lifetime License for Windows PC
Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.; EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
$99.99
Bestseller No. 5
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
PDF Pro 3 - PDF editor to create, edit, convert and merge PDFs - 100% Compatible with Adobe Acrobat - for Windows 11, 10, 8.1, 7
ALL-IN-ONE SOLUTION – read, edit, convert, merge and protect your PDF files
$29.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.