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

For browser-rendered HTML in an Elixir application, use ChromicPDF’s documented ChromicPDF.capture_screenshot/2 API. It can capture a local HTML file or a URL and returns a Base64-encoded PNG blob. ChromicPDF is primarily an HTML-to-PDF renderer, but this screenshot function makes it a practical Elixir-integrated route when you need an image. You must also install Chrome or Chromium for the browser rendering; Ghostscript is optional and is needed for PDF/A support and concatenating sources, not ordinary screenshot capture.

Capture HTML as an image with ChromicPDF

ChromicPDF runs a browser to render the page, so the output reflects browser rendering rather than a simple conversion of markup. The versioned ChromicPDF v1.17.1 API documentation documents capture_screenshot/2 and shows a PNG result encoded as Base64. The project describes itself primarily as an HTML-to-PDF renderer; screenshot capture is an additional entry point, not its sole purpose.

The simplest documented shape captures a local file:

{:ok, png_blob} = ChromicPDF.capture_screenshot({:url, "file:///path/to/page.html"})

Because png_blob is Base64-encoded, decode it before saving it as a normal PNG. For example, in code that has already configured ChromicPDF and can access the file:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
html_file = Path.expand("priv/static/card.html")
file_url = "file://" <> html_file

case ChromicPDF.capture_screenshot({:url, file_url}) do
  {:ok, png_blob} ->
    png_bytes = Base.decode64!(png_blob)
    File.write!("card.png", png_bytes)

  {:error, reason} ->
    raise "Screenshot capture failed: #{inspect(reason)}"
end

This follows the documented local-file input and Base64 output format; check the API documentation for the exact behavior of the ChromicPDF version installed in your application. The snippet assumes the library and browser dependency are configured and that the HTML file exists. It writes the decoded PNG bytes to card.png in the current working directory.

Capture a remote page

For a publicly reachable page, pass its URL in place of the file URL:

{:ok, png_blob} = ChromicPDF.capture_screenshot({:url, "https://example.com"})

A URL capture depends on the renderer being able to reach the page and its resources. If HTML references remote fonts, images, stylesheets, or scripts, those requests and their timing can affect what appears in the screenshot. If a page requires authentication or relies on browser state, confirm that your capture setup supplies what it needs; the cited ChromicPDF material does not establish a particular authentication workflow.

Install and deploy the renderer

ChromicPDF’s project README lists Chrome or Chromium as a requirement. Ghostscript is optional for PDF/A support and concatenating sources. If your application only captures images, do not install Ghostscript solely for that purpose.

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.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

The README records tested combinations including Elixir 1.15.7, Erlang/OTP 26.2, Alpine 3.18, Chromium 119.0.6045.159, and Ghostscript 10.02.0. It also includes older combinations. These are project-reported historical configurations, not a current support policy or a promise that a given combination is the latest compatible one. For a new deployment, check the package’s current installation guidance and verify the versions available for your operating system.

Plan for the browser as part of the application’s runtime, not just as a development tool. A deployment can fail even when the Elixir code is valid if Chrome or Chromium is absent, inaccessible to the renderer, or mismatched with the environment. Keep the Elixir, Erlang/OTP, browser, and operating-system versions deliberate and reproducible.

Choose the capture scope and image output

Before implementing capture, decide what the image must contain and how it will be consumed. Browser rendering can capture the page as a visitor sees it, but viewport, page content, and output format affect both the result and your downstream handling.

  • Whole page or visible viewport: Decide whether the image should include content beyond the initial viewport. The cited ChromicPDF API permits custom options for its underlying screenshot call; confirm the supported settings in the version you install rather than assuming every browser screenshot control is exposed.
  • PNG or JPEG: The API documentation demonstrates a JPEG format option, while its example result is Base64-encoded PNG. Choose a format based on the intended use: PNG is commonly appropriate for crisp interface graphics, while JPEG is useful where a lossy photo-oriented image is acceptable. Verify the specific option syntax in the versioned API docs.
  • Image data or file: The documented result is an encoded blob, so decode it before writing a regular image file or passing binary image data to another component. Do not save the Base64 text directly with a .png filename.
  • Static or dynamic content: For pages that load content after navigation, establish that the needed content has finished rendering before relying on a capture. The reviewed documentation does not establish a universal wait strategy for every application; test the page’s actual loading behavior.

ChromicPDF allows custom options for the underlying screenshot call, but do not assume that every feature documented by another browser tool is available through it. For example, Playwright documents viewport and full-page screenshots, output formats, scale, transparency, and element screenshots in its Page API. Playwright is browser automation software, not an Elixir library; the reviewed sources do not establish a particular Elixir integration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Or skip the browser setup

If you want a screenshot from Elixir without installing and operating a browser renderer yourself, ScreenshotNeo accepts a URL in one GET request and returns an image or PDF. Its HTML/CSS-to-image option can also suit generated markup when you can provide it through the service’s supported request options. See the ScreenshotNeo API documentation for request parameters and current usage details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
  • Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers report the page verdict and billing status.
  • An MCP server provides screenshot tools for AI agents, including Claude, Cursor, and other MCP clients.
  • The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots.

Create a free ScreenshotNeo account to try 1,000 screenshots a month without a card.

Keep screenshots reproducible

Browser-generated images can vary across environments. Playwright’s visual-comparison guidance notes that host operating system, browser version, settings, hardware, power source, and headless mode can affect rendering: Playwright visual comparisons. This is a general browser-rendering consideration, not a ChromicPDF-specific benchmark.

For visual tests or generated assets that must be comparable, use the same browser and host environment for captures and comparisons. Keep fonts and page resources consistent, avoid uncontrolled content changes, and treat browser or operating-system upgrades as changes that may affect screenshots. Do not assume a screenshot will be pixel-identical across machines simply because the HTML is unchanged.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Isolate rendering for untrusted HTML

HTML rendering runs a browser against input and can consume meaningful CPU and memory, particularly when jobs are large or concurrent. ChromicPDF’s documentation recommends considering a containerized renderer service with a small RPC boundary to create separation around Chrome and improve resource control. That is project guidance, not a guarantee that containers eliminate security risk.

If users can submit HTML or URLs, decide which inputs the renderer may access and how much work it may perform. Keep rendering capacity separate from latency-sensitive application work where practical, constrain resources at the service boundary, and avoid treating arbitrary user input as trusted just because it is rendered in a browser.

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

Troubleshooting common capture failures

  • Chrome or Chromium cannot be found: Install the browser dependency in the runtime image or host and check the ChromicPDF setup for the installed version. A working development machine does not prove the production container includes the browser.
  • Capture returns an error for a local page: Verify that the file exists, the renderer process can read it, and the file URL is valid. Use an absolute path when constructing the URL, and inspect the returned error rather than assuming the file was rendered.
  • The saved image is corrupt or unreadable: If the API result is Base64 text, decode it with Base.decode64!/1 before writing the image. Writing the encoded characters as if they were PNG bytes creates a file with the wrong contents.
  • Remote images or fonts are missing: Check that the renderer can reach those resource URLs and that the page does not depend on a session or network access unavailable to the capture environment. A browser screenshot can only show what the rendering session actually loaded.
  • Content is absent even though the page loads: The page may render important content after its initial navigation. Determine when that content becomes available and consult the installed ChromicPDF version’s options for controlling capture timing; do not assume an undocumented wait option.
  • Images differ between local and production runs: Compare browser and host versions, fonts, rendering settings, and headless behavior. Standardize the environment before treating the difference as an HTML defect.
  • Rendering slows the application under load: Browser jobs compete for resources. Limit concurrency according to the capacity you have measured in your own deployment, and consider a separate renderer service for isolation and resource management.

When to use a separate browser automation stack

ChromicPDF is a reasonable fit when the caller is Elixir-based, its documented screenshot entry point covers the capture you need, and operating Chrome or Chromium alongside the application is acceptable. It can also make sense when the same project needs ChromicPDF’s PDF-oriented capabilities in addition to image capture.

A separate Playwright-based workflow may fit a team that already operates browser automation and needs controls documented by Playwright, such as element screenshots or explicit scale and transparency options. That choice introduces a separate automation stack rather than an Elixir-native library path. The available documentation does not establish a specific Elixir integration, so assess the process or service boundary yourself rather than assuming a supported package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Compare the options against your real deployment: whether the capture must remain within the Elixir process, whether browser installation is acceptable, which image controls are essential, who owns browser upgrades, and how to isolate untrusted or high-volume jobs. No single route is best for every application.

Frequently Asked Questions

Does ChromicPDF require Ghostscript to create a screenshot?

No. The project lists Chrome or Chromium as the browser requirement; Ghostscript is optional for PDF/A support and concatenating sources.

Can I use Playwright as an Elixir library?

The cited Playwright documentation describes its browser automation API, but it does not establish a particular Elixir library integration.

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.

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