Skip to content

Article Mode Custom CSS Guide

In Just One Page PDF, Smart Article Extraction (Article Mode) cleans and restructures a webpage into an independent layout flow, enabling full support for the CSS Paged Media specification and extension-specific variables.

⚠️ Scope & Usage Limitations:

  1. Article Mode Only: The @page margin boxes, dynamic string() variables, and pagination counters covered in this guide take effect exclusively in Article Mode and are not parsed in original-webpage rendering modes such as Full Page Print.
  2. Do Not Combine with Multi-Page Frame Templates: This custom CSS syntax cannot be used together with Multi-Page Frame Templates. If you enable custom @page margin boxes or dynamic variables, ensure no Multi-Page Frame Template is stacked on top to avoid pagination and header/footer rendering conflicts.

  1. In the preview screen after entering Article Mode, locate the custom css option in the right-hand settings panel and click the gear icon next to it.
  2. In the pop-up editor, write your CSS directly—or click the preset dropdown menu in the bottom-left corner to quickly apply and customize built-in presets (such as advanced, clean, custom remote font, etc.).
  3. Once finished, click OK in the bottom-right corner to preview the layout changes in real time.

Inside an @page rule, you can insert content directly into the surrounding margin regions of each page, most commonly:

  • Top Regions: @top-left, @top-center, @top-right
  • Bottom Regions: @bottom-left, @bottom-center, @bottom-right
@page {
margin: 0.8in; /* Set page margins to leave space for headers and footers */
@bottom-right {
/* Bottom-right styling and content */
}
}

2. Page Numbering: Standard Counters vs. Extension-Specific Variables

Section titled “2. Page Numbering: Standard Counters vs. Extension-Specific Variables”

Inside the content property, there are two ways to insert page numbers—pay close attention to the difference between the functions:

ImplementationSyntaxMeaningSpecification
Counters (counter())counter(page) / counter(pages)Current page / Total pagesStandard CSS Paged Media syntax
Dynamic Variables (string())string(sitePage) / string(sitePages)Current page / Total pagesJust One Page PDF exclusive variables
@page {
@bottom-right {
/* Method 1: Standard CSS counters */
content: counter(page) " / " counter(pages);
/* Method 2: Extension-exclusive string() variables */
/* content: string(sitePage) " / " string(sitePages); */
font-size: 10pt;
color: #666666;
}
}

3. Dynamic Section & Metadata Variables (string() Function)

Section titled “3. Dynamic Section & Metadata Variables (string() Function)”

Using string(variableName), you can automatically pull section headings or article metadata from the current page to create book-grade dynamic headers and footers.

(1) Heading Variables: head1–6 vs. section1–6

Section titled “(1) Heading Variables: head1–6 vs. section1–6”

The extension provides two sets of hierarchical heading variables suited for webpages with varying structural rigor:

  • head1 – head6 (Strict Tag Mapping): Maps strictly to the actual HTML tags <h1> – <h6> in the article body. If a heading level is skipped in the source HTML (for example, jumping directly from <h1> to <h4>), the intermediate head2 and head3 variables remain empty.
  • section1 – section6 (Smart Level Normalization): Dynamically normalizes heading levels based on the headings actually present in the body, automatically eliminating skipped hierarchy gaps.
    • Example: If a webpage only uses <h1>, <h4>, and <h5>, the system automatically normalizes them to section1 (<h1>), section2 (<h4>), and section3 (<h5>). For webpages with inconsistent heading markup, the section series is recommended.

(2) Summary of Article Metadata & Page Number Variables

Section titled “(2) Summary of Article Metadata & Page Number Variables”
Variable NameSyntaxExtracted ValueCommon Use Cases
titlestring(title)Main article titleBook / long-article top header
subtitlestring(subtitle)Article subtitleSecondary top header text
authorstring(author)Article authorByline header or copyright footer
hostnamestring(hostname)Source website domain (e.g., example.com)Clean copyright attribution
urlstring(url)Full source webpage URLFooter source link
sitePagestring(sitePage)Current page number (extension-exclusive)Custom page number text
sitePagesstring(sitePages)Total page count (extension-exclusive)Custom total pages text

Paste the following code into the custom css editor to generate a publication-style layout featuring the article title, dynamic top-level section heading, source URL, and page numbers:

@page {
margin: 0.8in;
/* Top-left: Display main article title */
@top-left {
content: string(title);
font-size: 9pt;
color: #888888;
}
/* Top-right: Dynamically display current top-level section (auto-normalizes skipped H tags) */
@top-right {
content: string(section1);
font-size: 9pt;
color: #555555;
}
/* Bottom-left: Display source domain and full URL */
@bottom-left {
content: string(hostname) " | " string(url);
font-size: 8pt;
opacity: 0.55;
}
/* Bottom-right: Display current page and total pages using extension variables */
@bottom-right {
content: "Page " string(sitePage) " of " string(sitePages);
font-size: 9pt;
font-weight: bold;
}
}
body {
line-height: 1.6;
color: #222222;
}