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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Dompdf can show radio buttons in a generated PDF, but it renders them as static artwork rather than interactive AcroForm controls. Use normal HTML radio inputs with one shared name, a different value for each choice, and the boolean checked attribute on the option that should appear selected.

Dompdf’s built-in stylesheet draws an open-circle glyph for an unchecked radio and a filled-circle glyph for a checked one. The PDF will preserve that appearance, but a viewer cannot click the control and change the choice without a separate PDF-form workflow.

Minimal working example

This complete PHP example renders a two-option group and marks Pro as selected. Install Dompdf through the dependency method used by your application, then run the script in a PHP environment that can write the output file or stream a response.

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

require __DIR__ . '/vendor/autoload.php';

use DompdfDompdf;

$html = <<<'HTML'
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <style>
    label { display: block; margin: 4px 0; }
  </style>
</head>
<body>
  <form>
    <label>
      <input type="radio" name="plan" value="basic">
      Basic
    </label>
    <label>
      <input type="radio" name="plan" value="pro" checked>
      Pro
    </label>
  </form>
</body>
</html>
HTML;

$dompdf = new Dompdf();
$dompdf->loadHtml($html);
$dompdf->render();
$dompdf->stream('radio-buttons.pdf');

The shared name="plan" makes the choices one logical HTML group. The values are what a normal HTML form would submit, while checked determines which mark Dompdf draws at render time.

#1 Best Overall
Sale
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)

How Dompdf draws the control

Dompdf is an HTML-to-PDF layout engine with mostly CSS 2.1-compliant behavior. Its default stylesheet supplies separate rules for radio inputs:

  • input[type=radio]::before uses the 25CB open-circle glyph.
  • input[type=radio][checked]::before uses the 25C9 filled-circle glyph.

That implementation explains two common surprises. First, the mark is part of the page drawing, not a browser widget embedded in the PDF. Second, the checked rule is based on the checked attribute in the HTML Dompdf receives. Generate the final state in PHP before calling loadHtml(); do not depend on client-side JavaScript to change the property after the document has loaded.

Build a reliable radio group in HTML

Use one name and unique values

Every option in a single question should share one name. Give each option a distinct value so the markup remains meaningful if you also use it in a web form.

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.
<label><input type="radio" name="delivery" value="standard"> Standard</label>
<label><input type="radio" name="delivery" value="express" checked> Express</label>

Do not use a different name for every option; that describes separate controls rather than one choice. Keep labels associated with their inputs, either by nesting as above or by using matching for and id attributes.

Rank #2
Sale
Logitech G305 Lightspeed Wireless Gaming Mouse - Black
  • The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
  • Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
  • G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
  • Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
  • The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere

Set the selected state on the server

When the selected value comes from application data, emit the attribute conditionally in PHP. Escape text and attribute values as you normally would when constructing HTML.

<?php
$selected = 'express';
$options = [
    'standard' => 'Standard',
    'express'  => 'Express',
];

foreach ($options as $value => $label) {
    $isChecked = $value === $selected ? ' checked' : '';
    $safeValue = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
    $safeLabel = htmlspecialchars($label, ENT_QUOTES, 'UTF-8');
    echo "<label><input type="radio" name="delivery" value="{$safeValue}"{$isChecked}> {$safeLabel}</label>";
}

For a deterministic PDF, make sure exactly the intended option receives checked. If no option is selected, Dompdf will draw all of them as open circles. If your data can be invalid, validate it before generating the document and choose an explicit fallback policy.

Keep CSS within Dompdf’s supported subset

Simple block labels, margins, font declarations and ordinary color rules are safer than browser-only layout features. Start with the default radio appearance and add styling incrementally. A malformed stylesheet or unsupported layout rule can affect surrounding text even when the input markup is correct.

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

Static PDF appearance versus a fillable form

A rendered Dompdf radio button is suitable for invoices, reports, confirmations and other documents where the choice only needs to be visible. The generated PDF does not automatically contain a radio widget that a reader can focus, toggle or save.

Rank #3
Sale
Logitech M185 Compact Ambidextrous Wireless Mouse with Rubber Grips - Blue
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)

Dompdf’s CPDF adapter maps text, password and submit input types to AcroForm fields, but it has no corresponding radio branch. The project issue tracker also records requests describing inputs that display but cannot be filled; that behavior is consistent with the radio implementation.

When static artwork is the right result

  • The application has already made the decision and the PDF is a record of it.
  • The recipient only needs to print or view the selected state.
  • Values must not be changed after generation.

When you need an interactive radio control

Use a PDF library or a post-processing step that explicitly creates AcroForm radio widgets. A form-capable workflow also lets you control widget names, export values, appearance streams and accessibility metadata. PDFKit, for example, exposes APIs for creating radio-button widgets; choose a library that supports the PDF features and PHP or service architecture your application requires.

A practical two-stage design is to use Dompdf for the page layout, then pass the resulting PDF through an AcroForm-capable tool. Verify that the post-processor preserves fonts, page geometry and the selected value. If the document must remain editable, test it in the PDF viewers your recipients actually use.

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.

Remote assets, local files and document setup

Radio glyphs do not require an image or a network request. If your page also loads remote CSS, fonts or images, Dompdf must be configured to permit remote resources and PHP must allow the required URL access. Local files must be inside the configured Dompdf chroot. A radio group that works with inline CSS can appear to fail when an external stylesheet was silently blocked, so keep critical form styling inline or verify resource configuration.

Rank #4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
  • Computer mouse for easily navigating a computer interface; click, scroll, and more
  • USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
  • High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
  • 3 buttons offer effortless fingertip control
  • Plug-and-go ready for instant use

Use valid, well-formed HTML. Close labels, escape dynamic content and include a character encoding declaration when labels contain non-ASCII text. These steps reduce layout differences and make it easier to inspect the exact HTML sent to loadHtml().

Troubleshooting checklist

Symptom Likely cause Fix
Every circle is empty No input has a checked attribute, or the attribute was added only by browser JavaScript. Emit checked in the server-generated HTML before loadHtml().
The selected option is not the one expected The application selected the wrong value, or more than one option was marked. Log or inspect the final HTML, compare values strictly, and allow only one checked option per group.
Radio inputs appear as ordinary text or are missing Malformed HTML, a CSS rule that hides inputs, or unsupported custom styling. Reduce the markup to a plain input type="radio", validate the HTML, and reintroduce CSS one rule at a time.
The label is far from the circle Layout CSS is affecting inline or block formatting. Use a simple label layout such as display: block and small margins, then check the resulting PDF.
External styles or images do not load Remote-resource access is disabled, URL access is unavailable, or a local path is outside the chroot. Enable the remote-resource option only when needed, confirm PHP URL access, and place local assets within the configured chroot.
The PDF shows a mark but users cannot click it Dompdf produced static artwork, not an AcroForm radio widget. Switch to, or add, a PDF form-capable library and create radio widgets in a post-processing step.
Appearance differs between viewers Viewer rasterization, font substitution or page-scaling differences. Open the actual output in the target viewer and test at the intended print scale; do not infer interactivity from appearance.

Performance and reliability practices

  • Generate the selected state once on the server and pass a complete HTML string to Dompdf. This avoids timing-dependent client behavior.
  • Keep the radio markup and critical CSS local when possible. Fewer external dependencies mean fewer resource and chroot failures.
  • Reuse a stable template, but do not reuse stale selection data. The checked attribute must reflect the record being rendered.
  • For batch generation, record the input identifier and selected value alongside the output filename so an incorrect PDF can be traced back to its source data.
  • Inspect the PDF in at least one viewer used by your audience. A visible glyph confirms appearance only; it does not prove the presence of an editable form field.
  • If a workflow requires later editing, decide that before production. Adding form widgets after delivery is harder than choosing an AcroForm-capable pipeline up front.
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 goal is a clean screenshot or PDF capture of a web page rather than a fillable PDF form, ScreenshotNeo provides a one-request API. It is separate from Dompdf: it captures a URL as PNG, JPEG, WebP or PDF, while Dompdf converts your HTML in PHP.

ScreenshotNeo removes cookie-consent banners, newsletter popups and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing status in headers. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.

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

See the ScreenshotNeo API documentation for parameters and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await Bun.write('shot.webp', data);

Use Dompdf when you need PHP-controlled document layout and a static checked mark. Use a form-field workflow when the recipient must change the choice. Use ScreenshotNeo when you need a cleaned capture of a live page without setting up a browser.

Best Value
Sale
Acer Wireless Mouse for Laptop, 2.4GHz Computer Mouse 3 Adjustable 1600 DPI
  • 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
  • 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
  • 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
  • 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
  • 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

Implementation decision checklist

  1. Decide whether the PDF only needs to show a choice or must allow a viewer to change it.
  2. For a static result, use one shared name, unique value attributes and one server-rendered checked attribute.
  3. Keep the HTML well formed and use CSS that Dompdf supports.
  4. Configure remote resources and chroot paths only if the document actually needs external assets.
  5. Open the generated PDF in the target viewer and verify both the mark and the required interaction model.
  6. Choose an AcroForm-capable post-processor before shipping if editability or accessibility metadata is a requirement.

Frequently Asked Questions

Can I test the selected state without opening the PDF manually?

Yes. Treat the generated HTML as the first assertion: parse the radio group and verify that the expected option carries the checked attribute and that its name and value are correct. Then add a PDF-level visual or text inspection appropriate to your test stack; a source assertion alone cannot prove that a viewer will display the glyph as intended.

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

Are Dompdf radio buttons suitable for accessible, fillable government forms?

Not by themselves. The drawn circle does not provide an editable PDF form control or the full name, role, value and tagging metadata expected for an accessible interactive form. Use a workflow that creates tagged AcroForm widgets and validate the result with the accessibility tools required by your jurisdiction.

Why does a browser preview look different from the PDF?

A browser uses its native form-control renderer, while Dompdf applies its own stylesheet and glyphs during PDF layout. Compare the Dompdf output itself, and keep the markup and CSS simple when the printed appearance matters.

Quick Recap

SaleBestseller No. 1
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Product carbon footprint: 3.97 kg CO2e; Contoured shape: Gives you more comfort and control
$14.90
SaleBestseller No. 3
Bestseller No. 4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Computer mouse for easily navigating a computer interface; click, scroll, and more; 3 buttons offer effortless fingertip control
$9.70

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.