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.

The html2canvas error SyntaxError: Error parsing CSS component value, unexpected EOF means its CSS parser tried to read a component value but reached the end of the available tokens first. The message does not identify the stylesheet rule or computed style that caused it, so there is no single confirmed CSS edit that fixes every case. The reliable approach is to record the environment, reduce the capture to a minimal reproduction, then isolate the CSS input that triggers the parser.

What “unexpected EOF” means in html2canvas

EOF means “end of file” or, in this parser context, the end of the available token stream. In the cited html2canvas implementation, parseComponentValue() consumes leading whitespace and checks the next token. If that token is EOF, it throws SyntaxError: Error parsing CSS component value, unexpected EOF. In practical terms, the parser was asked for a CSS component value but had no token to consume.

This describes where parsing stopped, not which CSS declaration led it there. The exception does not name a selector, property, stylesheet, DOM node, or computed style. A declaration with an incomplete value is one possibility to investigate, but the error alone cannot confirm that diagnosis.

html2canvas reconstructs a rendering from the DOM and styles, and its documentation says it renders only CSS properties it understands. Its FAQ also notes that CSS property support is implemented manually and is not complete. That limitation makes styles and CSS feature support sensible things to inspect, but does not establish unsupported CSS as the cause of this particular exception.

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

Start by recording the failing capture

Before changing styles or upgrading packages, preserve the details needed to reproduce the failure. A change that appears to help may simply change the captured state, such as whether a chart has finished rendering or a component has mounted.

  • Record the html2canvas version. Include the exact version or release-candidate number, not just “current.”
  • Record the browser and operating system. Include browser version and whether the error occurs in another browser or environment.
  • Describe the capture target. Note the selector or element, whether it includes SVG, a chart, a web component, or content rendered by a framework, and how the capture is started.
  • Save the complete error and stack trace. Keep the exact exception wording so that the failing parser path can be matched against reports or a future issue.
  • Record the state at capture time. Note whether the page is still loading, the component is being updated, or the export runs after a user action.

These details matter because reported cases involve particular application contexts, rather than a confirmed universal trigger. An issue opened November 13, 2020, reported this exception in an Angular application compiled into a web component while converting a Highcharts SVG chart to JPEG for a PDF workflow. The report listed html2canvas 1.0.0-rc.7, Chrome 86, and macOS. Its author speculated about CSS associated with the web component or chart, but did not establish that as the root cause or document a confirmed fix. A Logseq whiteboard-export issue opened March 24, 2025, reported the same exception in a different application; it does not demonstrate a shared cause.

Reduce the capture to a minimal reproduction

Make a small page or test state that still triggers the exception. Start with the capture target and only the styles and generated content required to reproduce it. This is a diagnostic procedure, not an official one-click repair: smaller input gives you fewer declarations and DOM changes to investigate.

  1. Try the smallest meaningful target. If the error occurs while capturing a large page, capture the smallest child element that still fails. If the failing target is a chart or SVG, preserve that object in the test rather than removing the very content under investigation.
  2. Keep the same capture conditions. Use the same browser, html2canvas version, rendering state, and invocation timing. If the minimal case no longer fails, add back surrounding content or styles until it does.
  3. Separate application content from capture setup. Retain only the code needed to render the element and invoke html2canvas. Remove unrelated navigation, controls, and page sections when they are not needed to reproduce the failure.
  4. Confirm the reduced case more than once. If it fails intermittently, record what changes between attempts—such as whether the chart or component has finished rendering—before drawing conclusions about CSS.

A useful reproduction is one another developer can run and that fails consistently. If reduction removes the problem, that is still information: it suggests that the trigger may depend on surrounding styles, generated content, or application state that was removed.

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

Inspect CSS inputs and isolate a trigger

Check computed styles as well as authored styles

Look at the computed styles on the captured element and its relevant descendants, then trace suspicious values back to the declarations that produced them. A stylesheet can look complete while the value reaching a renderer is empty or differs because of a cascade, inherited value, runtime update, or generated style. Inspecting computed styles is a way to form and test a hypothesis; it is not evidence that every EOF error originates in a computed property.

Pay particular attention to values involving functions or grouped components if they appear incomplete or malformed. The parser failure means no component-value token was available at the point it requested one; it does not identify a particular function, property, or delimiter as the culprit. Treat any candidate declaration as something to test, not as a guaranteed cause.

Change one candidate at a time

  1. Choose one suspicious declaration or style source in the minimal reproduction.
  2. Temporarily remove it or replace its value with a simpler, complete value appropriate for that property.
  3. Run the same capture again and note whether the exception still occurs.
  4. If the failure disappears, restore the candidate and repeat the test to check whether the result is reproducible.
  5. Restore other removed declarations one by one until the failing input is isolated as narrowly as possible.

This method distinguishes a correlated style from a reproducible trigger. Do not leave a temporary style removal as a “fix” until you have confirmed that it preserves the page’s intended appearance and that the same capture succeeds under the conditions that originally failed.

Check generated content and capture timing

When the target contains framework-rendered or chart-generated content, verify that the element and its styles have reached the state you intend to capture. Then compare a capture before and after that state is reached. If only one state fails, include the difference in the reproduction. This does not prove that timing itself causes the parser exception, but it helps distinguish changing input from a stable CSS parsing problem.

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

Do not assume that an SVG, web component, Angular application, chart, or whiteboard is inherently responsible because one reported case involved similar content. Those reports are examples of contexts where the error appeared, not diagnoses transferable to another page.

Interpret the result without overclaiming

  • A declaration change consistently removes the error. You have evidence that the declaration or the state it changes is relevant in your reproduction. Verify the behavior with the intended page state and document the smallest working change.
  • The reduced reproduction still fails with the same input. Preserve that example, the complete stack trace, and the exact version and environment. It is useful material for a project issue report.
  • The error disappears only when unrelated page content is removed. Add content and style sources back gradually. The trigger may depend on an interaction among inputs rather than one obvious declaration.
  • The error stops occurring after an upgrade or browser change. Record that as an observed result for your reproduction, not a universal remedy. The available reports do not establish that updating html2canvas or changing browsers fixes this specific exception in general.

Browser CSS parsing and html2canvas parsing are not interchangeable. Browser CSS error recovery material, including the W3C CSS 2.2 working-draft discussion of parsing, concerns browser CSS behavior; it should not be used to infer exactly how html2canvas’s own parser handles the same input.

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

Report a reproducible failure

If a minimal case still throws the exception, provide enough information for someone else to reproduce it rather than reporting only the error text. The html2canvas FAQ recommends supplying a test case and reporting missing or incomplete CSS property support. A focused report should include:

  • a runnable minimal page or test case that reproduces the exception;
  • the exact html2canvas version, browser version, and operating system;
  • the target element and relevant HTML, SVG, and CSS;
  • the capture steps and the state of the page when capture begins;
  • the full exception and stack trace; and
  • the style-isolation steps you tried and what changed the result.

A report should distinguish confirmed observations from guesses. For example, say that removing a declaration makes your reduced test pass, if that is reproducible; do not claim that a whole framework or CSS feature is the cause unless the test establishes it.

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

Or skip the browser setup

If your goal is to obtain an image or PDF of a public web page rather than render an existing application element through html2canvas, a screenshot API is a different route. It does not repair html2canvas or replace an in-app DOM-to-canvas workflow; it captures a URL independently. ScreenshotNeo is a website screenshot API and MCP server, with clean shots that remove cookie banners, popups, and chat widgets before capture, and billing that excludes bot checks, blank pages, failed loads, and cache hits.

For a URL-based capture, one GET request returns an image or PDF. For example, this cURL request saves a WebP shot; 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

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan. See ScreenshotNeo for details, or sign up free for 1,000 screenshots a month with no card.

Frequently Asked Questions

Does this exception mean html2canvas reached the end of the HTML document?

No. In this message, EOF refers to the CSS component-value parser reaching the end of its available tokens while it was asked to consume a value; it does not by itself indicate that the HTML document ended unexpectedly.

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

Can I use the ScreenshotNeo call to capture an element already rendered in my app?

The shown request captures a URL. It is an alternative when a URL-based screenshot meets your goal, not a way to pass an existing in-memory DOM element to html2canvas.

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.