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.

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

If table borders disappear in an iTextSharp HTML-to-PDF conversion, first find out which parser is converting the HTML. In iText 5, HTMLWorker has limited CSS support; the documented CSS-aware route is XML Worker. Then check that the generated markup is structurally sound, that the stylesheet actually reaches the parser, and—if the output is already a PdfPTable—that its cells have visible borders. No single setting fixes every case: the cause depends on the markup, CSS, parser, and component versions.

1. Identify the parser before changing the CSS

Check the code path that turns HTML into PDF. If it uses HTMLWorker, CSS rules that work in a browser may not be applied during conversion. iText’s iText 5 guidance describes HTMLWorker as limited for CSS and recommends XML Worker when the conversion depends on CSS files or richer styling.

For a direct helper-based conversion, XML Worker’s ParseXHtml method accepts the PDF writer, document, HTML stream, and CSS stream. A minimal C# shape is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.tool.xml;

public static void ConvertHtmlToPdf(
    Stream htmlStream,
    Stream cssStream,
    Stream outputStream)
{
    using (var document = new Document())
    {
        var writer = PdfWriter.GetInstance(document, outputStream);
        document.Open();
        XMLWorkerHelper.GetInstance().ParseXHtml(
            writer, document, htmlStream, cssStream);
        document.Close();
    }
}

This illustrates the helper route; it is not a guarantee that every HTML or CSS feature will render identically to a browser. Use the namespaces and API signatures appropriate to the iTextSharp and XML Worker packages installed in your project. Ensure the streams are positioned at the beginning before parsing, and do not dispose of outputStream prematurely if the calling code still needs to read it.

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

If your application already uses XML Worker, do not switch parsers blindly. Continue with the markup, stylesheet, and cell checks below.

2. Confirm the table markup is valid and consistent

Inspect the HTML that the application actually sends to the converter, not just the original template or the browser-rendered page. A browser can recover from malformed markup in ways that a conversion parser may not. iText’s troubleshooting material identifies malformed HTML, incorrect CSS, and incorrect table column counts as possible causes of rendering problems.

  • Check that table, row, header-cell, and data-cell tags are balanced and properly nested.
  • For each row, verify the effective number of columns, accounting for colspan. Check that rowspan values do not create an inconsistent structure.
  • Look for missing closing tags, stray text between table elements, and malformed attributes in dynamically generated HTML.
  • Check the final HTML after data binding, conditional sections, or template substitutions. A correct template can still produce broken output for a particular record.

Reduce the issue to one small table with one row and a few cells. First give a cell an explicit border in the markup, then test the same rule in the stylesheet. If the explicit cell border works but the stylesheet version does not, the problem is more likely in CSS support or stylesheet delivery than in the table’s basic structure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

3. Verify that the CSS is part of the XML Worker pipeline

Passing an HTML stream to XML Worker does not by itself make a separate CSS file available to the parser. The CSS must be supplied through the helper overload or, in a manually assembled pipeline, added to the CSS resolver. The documented table example follows this sequence: create a resolver, add the CSS file, connect the resolver to the HTML pipeline, and parse the HTML.

In the helper example above, confirm that cssStream contains the stylesheet you intend to use and that it is the stream passed to ParseXHtml. If the stylesheet is assembled at runtime, log or save its final contents while diagnosing the problem. Test with a minimal rule such as td { border: 1px solid #000; } and verify that it reaches the parser. Do not assume that a CSS rule supported by a browser is necessarily supported the same way by the XML Worker version in use.

For a custom pipeline, the important shape is:

  1. Create a StyleAttrCSSResolver.
  2. Load the CSS with XMLWorkerHelper.GetCSS(cssStream) and add it to the resolver.
  3. Attach that resolver to a CssResolverPipeline leading into the HTML pipeline.
  4. Pass the pipeline to XMLWorker, then parse the HTML stream with XMLParser.

The official example demonstrating this pipeline is written in Java; class names and casing can differ in C#. Treat it as the pipeline design, not a drop-in C# listing. If you do not need custom pipeline behavior, the helper method is simpler.

Rank #3
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
  • INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
  • SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
  • EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
  • SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning

4. Check whether the table is still HTML or is already a PdfPTable

Once conversion has produced a PdfPTable, HTML and CSS are no longer the right place to diagnose the border. In the iText 5 object model, borders are defined at the cell level, not by one table-wide border switch. Inspect the PdfPCell instances and, where cells are created implicitly, the table’s default-cell settings.

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

For cells created in code, set a border on each cell as appropriate to the design. For example:

var cell = new PdfPCell(new Phrase("Value"));
cell.Border = Rectangle.BOX;
table.AddCell(cell);

If the table is built using table.AddCell("Value") or another convenience method, inspect table.DefaultCell; the default cell settings affect implicitly created cells. A border that was explicitly set to Rectangle.NO_BORDER will remain invisible until that setting is changed. For custom outlines or special border behavior, iText’s guidance points to cell events or table events rather than a single global border property.

Rank #4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

5. Check both component versions without assuming an upgrade is the fix

Record the exact iTextSharp and XML Worker versions used at runtime, including whether the application loads different assemblies than the ones referenced during development. iText’s troubleshooting guidance warns that older versions had weaker CSS and table support. That is a reason to investigate version-specific behavior, not proof that a particular upgrade will resolve this specific symptom.

The iText 5.5.4 release notes describe table-related rendering and border changes in the broader iText product set, but they do not establish that 5.5.4 fixes every missing-border issue in an iTextSharp XML Worker conversion. Before upgrading, check compatibility with the application and test the smallest reproduction against the exact candidate versions. Avoid promising a fix based on a version number alone.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Use this diagnostic order to isolate the failure

  1. Record the parser. Determine whether the path is HTMLWorker, XML Worker’s helper, a custom XML Worker pipeline, or code that constructs PdfPTable directly.
  2. Capture the generated input. Save the exact HTML and CSS sent to the conversion code for a failing case.
  3. Validate structure. Check balanced tags, row and cell counts, and span values.
  4. Test an explicit cell border. Use a minimal table and put the border directly on a td or th.
  5. Test stylesheet delivery. Apply the equivalent rule through the stylesheet and verify that the stylesheet stream is connected to the XML Worker helper or CSS resolver.
  6. Inspect the PDF object model. If the result is a PdfPTable, inspect actual and default cell border settings.
  7. Reproduce by version. Keep the same minimal HTML, CSS, and code while comparing the exact iTextSharp and XML Worker versions.

This order separates parser limitations, input defects, missing CSS, and cell configuration rather than treating them as one generic “table border” problem.

Best Value
Sale
ScanSnap iX2500 Wireless or USB High-Speed Document Scanner, Black
  • OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
  • CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
  • STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
  • PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
  • AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss

7. Common symptoms and fixes

Symptom Likely branch to inspect Next action
Inline styling appears, but stylesheet rules do not The stylesheet may not be supplied, or the active parser may have limited CSS support. Confirm XML Worker is used and pass the CSS stream to the helper or add it to the CSS resolver.
Only some rows or cells lose borders Generated markup, conditional content, spans, or per-cell settings may differ in those rows. Compare the generated HTML for a working and failing row; inspect each affected PdfPCell if the table is already constructed.
No borders appear, even with a stylesheet rule The stylesheet may not reach parsing, the parser may not support the rule as expected, or the input structure may be invalid. Test a minimal table with an explicit border on a cell, then repeat with the stylesheet.
Browser preview is correct but PDF is not Browser rendering and the selected iText parser do not necessarily support the same HTML/CSS. Use XML Worker for CSS-dependent iText 5 conversion and simplify the input to supported, tested rules.
Borders disappear after converting to PdfPTable Cell or default-cell border settings may specify no border. Inspect the border property for every explicit cell and the table’s default cell.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not an HTML-to-PDF converter, so it will not repair iTextSharp output. It can be useful when the separate task is capturing a web page as an image or PDF. One GET request can return a screenshot or PDF; see the 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 and consent banners, newsletter popups, and chat widgets before capture; those cleanup steps can each be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. It also provides an MCP server with screenshot, page-info, and PDF-capture tools for AI agents. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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

8. When the border is still missing

Prepare a minimal failing example containing the exact HTML, CSS, parser call or pipeline, and the iTextSharp and XML Worker versions. Include the resulting PDF or a description of which borders are absent, and note whether the minimal explicit-cell-border test worked. Those details make it possible to distinguish a CSS support limitation from a malformed table or a cell-level setting. If asking for help, avoid sharing private page content or credentials; replace sensitive values while preserving the table structure and styling.

Frequently Asked Questions

Does adding border="1" to the table guarantee visible borders in the PDF?

No. The result still depends on the parser, the generated markup, and any cell-level border settings in the resulting PDF table.

Can a border disappear only in the PDF even though the page looks correct in a browser?

Yes. A browser and an iText 5 parser need not apply the same HTML and CSS behavior.

What information should I include in a bug report about this problem?

Include a minimal failing HTML/CSS sample, the conversion code path, and the exact iTextSharp and XML Worker versions.

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.

Quick Recap

Bestseller No. 4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.