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.

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

iText 5 XML Worker may omit HTML <input type="checkbox"> controls when converting XHTML to PDF. If you only need a printed mark, put a ballot-box character such as ☐ or ☒ in the HTML and use a font that contains it. If readers need to click the box in the PDF, create an AcroForm checkbox field explicitly; XML Worker does not automatically turn the HTML input into that interactive field in the reported cases.

Those reports concern XML Worker 5.4.1/5.4.2 and 5.5.5. They show a recurring problem, not an official guarantee that every version or custom tag processor behaves identically. Check the exact pipeline you ship.

First choose: printed checkbox or interactive PDF field?

These are different outputs. A Unicode ballot-box character is static page content: it can be viewed and printed, but it cannot be toggled in a PDF viewer. An AcroForm checkbox is a named PDF form field that a reader can interact with. Decide which behavior your document requires before changing the HTML or debugging CSS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Approach What appears in the PDF Use it when What you must handle
Unicode ballot-box glyph Static text, such as ☐ or ☒ The mark only needs to be visible or printable The chosen PDF font must contain the glyph; the mark’s state is fixed in the content.
Explicit AcroForm field An interactive checkbox PDF users need to select or clear the box Your application must create and position the field, set its name and initial state, and provide its appearance.
Move to pdfHTML HTML-to-PDF conversion using iText’s newer product line You can change libraries and need a current conversion path Check the specific pdfHTML version’s form support, API, compatibility and licensing; do not assume it behaves like XML Worker.

The checkbox omission reports are community reports, not an iText-maintained XML Worker compatibility matrix. One describes XML Worker 5.4.1 with iText 5.4.2; another reports omitted inputs with XML Worker 5.5.5. Treat them as useful evidence of a practical limitation, not proof about every configuration. (Stack Overflow, “HTML to PDF – How to display checkbox using itext XMLWorker” and “HTML to PDF using Itext (checkbox, radio) not rendered.”)

For a static mark, put the character in the XHTML

When no interaction is required, replace the input control with actual text. For example:

<p>☐ Accept the terms</p>
<p>☒ Send me updates</p>

The first character is an unchecked ballot box; the second is a box with a cross. You can use another appropriate checked glyph if your chosen font supports it. The Stack Overflow answer on XML Worker checkbox display specifically suggests a Unicode ballot-box character for print-oriented output.

This avoids depending on XML Worker to interpret an HTML form control. It does not create a form field, expose a checkbox state to PDF form software, or make the mark accessible as an interactive control. If the user must be able to change the selection, use an AcroForm field instead.

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

Check font coverage in the generated PDF

A glyph that looks correct in your source file can still become a blank, replacement symbol, or missing-character box in the PDF. The font used when generating the PDF must contain the character, and your PDF font handling must make it available in the output. If it does not render, select a font with the required glyph and configure your font provider accordingly, or draw the mark using a method your PDF pipeline supports. Verify the resulting PDF in the viewers and print path that matter to your users.

Do not treat “the HTML contains the symbol” as proof that it reached the PDF. Test both unchecked and checked marks, and inspect the generated file rather than relying only on a browser preview of the XHTML.

Convert XHTML with XML Worker without relying on input checkboxes

XML Worker belongs to the iText 5 generation and is intended to parse XHTML/CSS content into PDF, not to reproduce an arbitrary live webpage. It expects finished, well-formed XHTML and does not execute JavaScript. Keep the checkbox representation in the source explicit: use text for static marks, or handle interactive fields separately.

A minimal Java conversion using XML Worker is:

import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.tool.xml.XMLWorkerHelper;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;

public class HtmlToPdf {
    public static void main(String[] args) throws Exception {
        String htmlPath = args.length > 0 ? args[0] : "input.html";
        String pdfPath = args.length > 1 ? args[1] : "output.pdf";

        Document document = new Document();
        try (FileOutputStream output = new FileOutputStream(pdfPath)) {
            PdfWriter writer = PdfWriter.getInstance(document, output);
            document.open();
            try (FileInputStream html = new FileInputStream(htmlPath)) {
                XMLWorkerHelper.getInstance().parseXHtml(
                    writer, document, html, null, StandardCharsets.UTF_8, null);
            }
            document.close();
        }
    }
}

Provide a well-formed XHTML file as input.html, including the literal glyph where a static box should appear. Run the class with the iText 5 and XML Worker libraries available on the classpath. The example uses XMLWorkerHelper’s XHTML parsing API; confirm that the API signature matches the XML Worker version in your project. The iText 5.5.13.6 API documentation documents XMLWorkerHelper and its parsing methods.

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

This minimal example does not configure a custom font provider. If a ballot-box character is missing, configure font handling for the font containing that glyph rather than assuming the default font setup will cover it. Nor does this conversion code convert an HTML input into an AcroForm field.

For an interactive checkbox, create an AcroForm field

In iText 5, build the checkbox as a PDF form field and add it to the document as an annotation. The following Java example demonstrates the core approach: it creates a PDF, adds a checkbox named acceptTerms, gives it a page rectangle, and sets its initial state. Adjust the rectangle to match your document layout.

import com.itextpdf.text.Document;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.RadioCheckField;

import java.io.FileOutputStream;

public class InteractiveCheckboxPdf {
    public static void main(String[] args) throws Exception {
        String pdfPath = args.length > 0 ? args[0] : "checkbox.pdf";

        Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(
            document, new FileOutputStream(pdfPath));
        document.open();

        // Coordinates are PDF page points, measured from the lower-left.
        Rectangle box = new Rectangle(72, 720, 88, 736);
        RadioCheckField checkbox = new RadioCheckField(
            writer, box, "acceptTerms", "Yes");
        checkbox.setCheckType(RadioCheckField.TYPE_CHECK);
        checkbox.setChecked(false);
        writer.addAnnotation(checkbox.getCheckField());

        document.close();
    }
}

The iText tutorial “Chapter 4: Making a PDF interactive | .NET” demonstrates the same general PDF-form approach and checkbox state concepts, including explicit field creation. Its .NET example is not Java code, and it does not establish that XML Worker maps HTML checkbox inputs automatically. The Java example above uses iText 5’s RadioCheckField API; compile it against the iText 5 version in your application and verify the field’s appearance and placement in your target PDF viewers.

Map HTML data to PDF fields deliberately

If your source form is HTML, your application must decide how each input maps to a PDF field. For every checkbox, define a stable field name, its page and rectangle, whether it starts checked, and the appearance users will see. If the form layout can grow or wrap across pages, establish how your renderer determines final positions before creating annotations. Styling input[type=checkbox] with CSS does not itself create a PDF widget.

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

iText’s newer pdfHTML documentation describes form conversion and an AcroForm setting, but that is evidence about pdfHTML, not an XML Worker setting. Do not copy a pdfHTML option such as setCreateAcroForm(true) into an XML Worker pipeline and expect it to work.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When migration to pdfHTML makes sense

iText labels XML Worker a legacy product, and its downloads guidance says iText 5/iTextSharp has reached end of life and points current HTML-to-PDF work toward iText Core with pdfHTML. For new development, or when maintaining the XML Worker workaround is becoming costly, evaluate whether pdfHTML fits your supported HTML/CSS and form requirements.

Migration is a change of product generation and API, not a drop-in promise that every existing document will render identically. Check the form-conversion features in the documentation for the exact pdfHTML release you plan to use, test representative documents, and review licensing for your intended deployment. XML Worker’s XHTML/CSS parsing scope and pdfHTML’s form features are documented separately by iText.

Troubleshooting missing or incorrect checkboxes

  • The HTML input disappears: XML Worker checkbox omission is reported in multiple versions, including 5.4.1 and 5.5.5. Replace it with a glyph if static output is sufficient; create an AcroForm field if it must be interactive.
  • The ballot box becomes an empty square or question mark: the selected font may lack the glyph, or font handling may not make it available in the PDF. Use a font with the character and configure the PDF font provider; then inspect the output PDF.
  • The box is visible but cannot be clicked: that is expected for a Unicode character. Static printed content is not an AcroForm widget. Generate a named field with a deliberate rectangle and state.
  • The field is present but in the wrong place: PDF form fields have explicit page coordinates. Recalculate the rectangle against the final page layout and coordinate system; do not assume an HTML element’s CSS box is automatically carried over.
  • Only part of the HTML appears: validate that the input is well-formed XHTML and that required content is already present in the file. XML Worker does not execute page JavaScript or render a live website.
  • A pdfHTML form option has no effect: verify which library is actually running. pdfHTML’s form settings are not XML Worker APIs.

Or skip the browser setup

If your real task is capturing a live webpage as an image or PDF—not converting your XHTML into a PDF with interactive form fields—ScreenshotNeo provides a one-request screenshot API. It is not a replacement for XML Worker or AcroForm field creation; it captures a URL. Its cookie-banner, popup and chat-widget cleanup can be turned off, and its responses identify page verdict and billing status.

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

cURL example and ScreenshotNeo API documentation:

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

ScreenshotNeo removes cookie banners, popups and chat widgets before the shot; bot checks, blank pages and failed loads are never billed; an MCP server lets AI agents take screenshots; and 1,000 screenshots a month are free with no card, with paid plans starting at $5 for 3,000. See ScreenshotNeo for the service details, or sign up for the free plan.

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.