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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If Chromium creates no PNG or PDF on Ubuntu, first confirm the binary and version, run it from a writable directory with an explicit output path, and inspect stderr and the exit status. The commands below provide a known-good baseline. Most failures come from an unwritable current directory, content that has not finished loading, sandbox problems in a container, or a browser update that changed which headless implementation is available.

Start with a known-good capture

Use a dedicated directory so the output location and permissions are unambiguous:

mkdir -p /tmp/chromium-capture
cd /tmp/chromium-capture
chromium --headless --screenshot=shot.png --window-size=1280,800 
  --timeout=5000 https://example.com
chromium --headless --print-to-pdf=example.pdf 
  --no-pdf-header-footer --timeout=5000 https://example.com
ls -lh shot.png example.pdf

Replace chromium with the executable installed on your system, such as google-chrome. A successful run should leave shot.png and example.pdf in the directory. Without an explicit filename, Chromium traditionally writes screenshot.png and output.pdf in the current working directory. Automation should always use an absolute, writable output path.

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

Verify which browser you are actually running

Ubuntu systems may use a distro Chromium package, a Google Chrome package, a snap, a container image, or the separate chrome-headless-shell artifact. Their command names and supported flags can differ. Record the executable and milestone before changing anything:

#1 Best Overall
Lenovo Business Laptop - Linux Mint (Cinnamon) - Intel i5-1335U, 16GB RAM, 256GB SSD, 15.6" FHD 1920x1080 Display, Full Keyboard, Fast Charging
  • Intel Core i5-1335U Processor (12M Cache, 12 Threads, up to 4.6 GHz) - 256GB Solid State Drive - 16GB DDR4 SDRAM
  • 15.6" FHD (1920x1080) Non-Touch Anti-Glare Display - Intel UHD 620 Integrated Graphics - Stereo Speakers
  • 720p HD Webcam with Privacy Shutter. Integrated Microphone - Intel Dual Band Wireless-AC (2x2) 8265, Bluetooth Version 4.2
  • I/O Ports: 2x USB 3.0, 1x USB 3.1 Type-C 3.1, Headphone/Mic Combo Port, 4-in-1 Card Reader, HDMI, Kensington Mini-Lock Slot
  • Linux Mint (Cinnamon) 64-Bit - Keyboard with Full NumberPad - Fast Charging
chromium --version
google-chrome --version
command -v chromium
echo "$PWD"
id

Run only the version command that matches an installed executable. If the command is missing, install or invoke the browser that your image actually contains; changing flags cannot repair a nonexistent binary. In CI, print this information in every job so an automatic package update is visible in logs.

Use the right flags for screenshots and PDFs

PNG screenshots

--screenshot captures a PNG. Add a filename when the job needs a predictable artifact, and use --window-size=WIDTH,HEIGHT to set the viewport:

chromium --headless 
  --screenshot=/tmp/chromium-capture/home.png 
  --window-size=1440,900 
  --timeout=10000 
  https://example.com

The window size controls the screenshot dimensions. It is not a substitute for full-page behavior or responsive breakpoints; choose dimensions that exercise the layout you want to test.

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

PDF output

--print-to-pdf writes a PDF. Give it an explicit filename and remove Chromium’s generated date, URL, and page-number furniture with --no-pdf-header-footer:

chromium --headless 
  --print-to-pdf=/tmp/chromium-capture/report.pdf 
  --no-pdf-header-footer 
  --timeout=10000 
  https://example.com

Older Chromium releases used --print-to-pdf-no-header instead. If the current spelling is rejected, check the installed browser’s help output and use the spelling supported by that version rather than copying a flag from an older script.

Rank #2
HP 17 Business Laptop - Linux Mint Cinnamon - Intel Quad-Core i5-10210U, 32GB RAM, 1TB PCIe NVMe SSD + 1TB Storage HDD, 17.3" Inch HD+ (1600x900) Display
  • Intel Core i5-10210U (up to 4.2GHz) - 1TB PCIe NVMe + 1TB HDD - 32GB DDR4 SDRAM
  • 17.3" HD+ (1600x900) Display, Intel UHD Graphics 620
  • Built in HD 720p Webcam with Microphone - Bluetooth Version4.2
  • I/O Ports: 2x USB 3.1 (Data Only), 1x USB 2.0, 1x HDMI, 1x Headphone/Microphone Combo Jack
  • Linux Mint Cinnamon 64-Bit - 6-Row Keyboard w/ Full Numberpad

Wait for late content

--timeout=milliseconds gives the page more time to load. It does not guarantee that every JavaScript application, web font, image, or third-party request will finish. For pages that update themselves with timers, --virtual-time-budget=milliseconds advances virtual time before capture:

chromium --headless 
  --screenshot=timed.png 
  --window-size=1280,800 
  --timeout=15000 
  --virtual-time-budget=10000 
  https://example.com

Use both when appropriate: the timeout controls how long Chromium waits, while the virtual-time budget lets timer-driven page code progress. Confirm that the Ubuntu host or container can reach the URL; no flag can load a page when DNS, routing, authentication, or a proxy is failing.

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

If no file appears, inspect the process before changing flags

Check the exit status and stderr

Immediately capture diagnostics:

chromium --headless --screenshot=/tmp/chromium-capture/test.png 
  --window-size=1280,800 https://example.com 
  >/tmp/chromium-capture/stdout.log 
  2>/tmp/chromium-capture/stderr.log
echo "exit=$?"
cat /tmp/chromium-capture/stderr.log

An absent file with a nonzero exit status points to startup, navigation, or output errors. A zero status with an unexpected location usually means the relative path was resolved against a different working directory than you assumed.

Fix the output directory and user permissions

Ensure the directory exists and is writable by the account that launches Chromium:

mkdir -p /var/tmp/my-captures
chmod u+rwx /var/tmp/my-captures
chromium --headless 
  --screenshot=/var/tmp/my-captures/page.png 
  https://example.com

In a service or container, the runtime user may not be your interactive shell user. Check ownership and mount permissions, and avoid writing to a read-only workspace. An absolute filename also prevents a job runner from hiding the artifact in an unexpected current directory.

Rank #3
Panasonic Toughbook CF-31 MK5 Rugged Laptop, 13.1in i5, 8GB 256GB (Renewed)
  • [ULTRA-RUGGED DESIGN] MIL-STD-810G and IP65 certified. Built to survive 6-foot drops, heavy rain, and extreme vibrations. Features a magnesium alloy chassis with an integrated carry handle for maximum portability
  • [4G LTE - WORK ANYWHERE] Integrated 4G LTE Multi-Carrier Mobile Broadband. Stay connected to the internet in remote areas or on the road without relying on Wi-Fi or phone hotspots. True mobile freedom for field professionals
  • [1200-NIT SUNLIGHT READABLE] 13.1" XGA Touchscreen with CircuLumin technology. At 1200 nits, it is nearly 4x brighter than a standard laptop, ensuring perfect visibility under direct, intense sunlight
  • [LINUX UBUNTU PRE-INSTALLED] Fast, secure, and bloatware-free. Optimized for developers, network engineers, and diagnostic software that thrives in a stable, open-source environment
  • [LEGACY SERIAL PORT] Features a native RS-232 Serial Port, HDMI, and USB 3.0. Essential for connecting directly to industrial machinery, CNCs, and automotive diagnostic tools without unreliable adapter

Distinguish a blank page from a failed capture

A file can exist yet contain a blank or incomplete page. Increase the timeout, add a virtual-time budget for timer-based interfaces, and test the same URL with a simple public page. Missing fonts or images generally indicate network access, certificate, proxy, or resource-blocking problems in the runtime. Capture stderr and verify connectivity from inside the same container or VM.

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

Resolve sandbox and container errors safely

Messages mentioning setuid helpers, namespaces, or the sandbox usually describe the runtime rather than the web page. The durable fix is to run Chromium as a non-root user and repair the package or container prerequisites so the sandbox can initialize.

  • Use a dedicated non-root account for the capture process.
  • Install the browser package and its sandbox components in the image that actually runs the command.
  • Verify that required user namespaces and filesystem permissions are available in the container or CI executor.
  • Keep the browser profile and output directory writable by that account.

--no-sandbox disables a security boundary. It can be a short diagnostic in an isolated environment: if the capture works only with that switch, the runtime setup is the problem. Do not make it the routine production solution; remove it after repairing the user, image, or namespace configuration.

Account for headless changes after browser updates

M132 and the end of old headless in the Chrome binary

Chromium’s current headless documentation states that, from milestone 132, the old headless implementation is no longer part of the Chrome binary, so --headless=old has no effect. Workflows that specifically depend on old headless should migrate to the supported chrome-headless-shell artifact instead of relying on that flag.

Before and after an upgrade, compare the recorded milestone, executable path, and package source. A script that silently switches from a full browser package to another binary can appear to fail even though the URL and command did not change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Lenovo V15 Gen 4 - Business Laptop - AMD Ryzen 5 7430U - 15.6" FHD Display - 8GB RAM - 512GB SSD Storage - Integrated AMD Radeon™ Graphics - Webcam Privacy Shutter - Business Black
  • THE POWER TO STAY PRODUCTIVE – Looking to make your everyday work and home life more manageable without breaking the bank? The Lenovo V15 Gen 4 offers long-term reliability with top-of-the-line features to make you your most productive self.
  • CRUSH YOUR TO-DO LIST – The AMD Ryzen CPU pairs quiet performance and enhanced operating power to crush your high-demand workday. It optimizes performance and allows for seamless multitasking.
  • TRUE-TO-LIFE VISUALS – The 15.6” FHD IPS display is anti-glare with 300 nits brightness to see your best outside or in. Its 88% screen-to-body ratio makes viewing detailed applications like spreadsheets a breeze.
  • SEAMLESS COLLABORATION – Lenovo Smart Appearance enhances your camera effects to protect your privacy and to make you the focus of every video conference. Intelligent noise cancelation minimizes distraction and Dolby Audio provides an elegantly sonorous experience.
  • BUILT TO WITHSTAND – Built for military-grade toughness, the V15 Gen 4 is tested to withstand harsh temperatures, pressure, humidity, vibrations and more. Keep your work safe from the board room to your living room and everywhere in between.

Use historical regressions as clues, not permanent fixes

A 2024 issue documented a regression in which headless PDF output stopped after an update and was temporarily worked around with --headless=old. That issue is marked fixed. Treat it as a version-diagnosis clue: reproduce the failure with a minimal URL, record the milestone, and test a supported browser build or chrome-headless-shell. Do not assume the historical workaround is a current universal answer.

Choose an implementation for your workload

Approach Best fit Important trade-off
Current Chrome/Chromium headless CLI Simple one-off PNG or PDF jobs and shell-based CI Output timing, browser packaging, and filesystem permissions are your responsibility.
chrome-headless-shell Workflows that require the old-headless architecture after M132 You must package and pin a separate artifact and track its supported flags.
Puppeteer or the DevTools Protocol Multi-step automation, DOM waits, interactions, and detailed error handling More application code and browser lifecycle management than a single CLI invocation.
ScreenshotNeo API Remote, repeatable captures without maintaining a browser installation Requires an API key and an HTTP request; output and page controls are configured through request parameters.

For reproducible CLI jobs, pin the browser build, record its version, run a smoke-test URL, use a dedicated writable directory, and archive stderr alongside generated files. These practices make package, sandbox, and page-load failures distinguishable.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. It accepts one GET request and returns a PNG, JPEG, WebP, or PDF. Before capture it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and whether the request was billed.

Using the API avoids installing Chromium in Ubuntu or CI. The following requests target the same example URL; replace it with your page and use the parameter names documented at the ScreenshotNeo documentation.

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.

cURL

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

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

Controls available on every plan

ScreenshotNeo supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper size, margins, landscape mode and page ranges, HTML/CSS-to-image, custom CSS and JavaScript, pre-capture clicks, hidden selectors, waits for a selector, delay or network idle, blocking for ads, trackers, requests or resource types, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, image resizing, cache TTLs, signed links for public <img> tags, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which simplifies migration.

Plans are:

Plan Allowance Price
Free 1,000 shots/month $0, no card
Starter 3,000 shots $5
Growth 15,000 shots $15
Pro 60,000 shots $39
Scale 250,000 shots $99
Business 1,000,000 shots $249

Every feature is included on every plan, and yearly billing gives two months free. The MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients, so an AI agent can request captures without managing a local browser.

Best Value
Lenovo IdeaPad Slim 3 Linux Laptop, 15.6" FHD Touchscreen Laptop, 8-Core AMD Ryzen 7 5825U, 16GB RAM, 512GB SSD, Keypad, SD Card Reader, Stylus Pen + External Portable SSD + USB Hub, Linux Ubuntu OS
  • Powerful Linux Laptop: This IdeaPad Slim 3 Laptop comes pre-installed with Ubuntu Linux, offering fast performance, robust security, and a clean, user-friendly experience. Enjoy full customization, seamless hardware compatibility, and access to thousands of open-source apps. Whether you're working, creating, or coding, it's built to keep up with everything you do.
  • A Multitasking Master: The latest AMD Ryzen 7 5825U processor (up to 4.5 GHz) delivers powerful performance with 8 cores and 16 threads for smooth multitasking. Integrated AMD Radeon Graphics provide crisp visuals for streaming, browsing, photo editing, and casual gaming. With smart machine intelligence, it adapts to your needs for a fast, responsive experience.
  • 15.6" Full HD Display: The IdeaPad Slim 3 boasts an 88% screen-to-body ratio for a floating, edge-to-edge visual experience. TÜV Low Blue Light certification reduces eye strain, making it perfect for long work or study sessions.
  • Military-Grade Durability: The smart IdeaPad Slim 3 combines portability and durability, letting you work, study, and play on the go. With a profile 10% slimmer than the previous generation, it's lightweight yet military-grade rugged, ready for anything, anywhere.
  • Versatile Connectivity: Enjoy the security of a built-in webcam with a privacy shutter. Connect effortlessly with multiple ports: 2x USB A, 1x USB C, 1x HDMI, 1x SD Card Reader, 1x Headphone/Microphone combo. Bundle comes with Stylus Pen, 256GB Portable SSD and 5-in-1 Docking Station.

Create a free ScreenshotNeo account to get 1,000 screenshots each month without a card; paid plans start at $5 for 3,000 shots.

CI reliability checklist

  • Pin and record the exact browser build and package source.
  • Run --version and a minimal smoke capture on every image change.
  • Use an absolute output path in a directory writable by the runtime user.
  • Set a timeout appropriate to the page and add a virtual-time budget for timer-driven content.
  • Archive stderr, the exit status, the browser version, and the resulting PNG or PDF.
  • Keep the sandbox enabled in production; investigate the image or user setup when it fails.
  • When behavior changes after an upgrade, check the milestone, M132 headless architecture, and whether the job should use chrome-headless-shell.

FAQ

Does a longer timeout guarantee that a single-page app is fully rendered?

No. It only gives Chromium more wall-clock time. The page may still depend on blocked requests, authentication, timers, or conditions that never resolve. Combine a suitable timeout with a virtual-time budget where needed and verify the runtime’s network access.

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

What should I do if an old script still contains --headless=old?

Check the browser milestone first. From M132 that mode is no longer in the Chrome binary. If the workflow truly requires old-headless behavior, migrate to the supported chrome-headless-shell artifact and pin the build rather than depending on the obsolete switch.

Frequently Asked Questions

Does a longer timeout guarantee that a single-page app is fully rendered?

No. It only gives Chromium more wall-clock time. The page may still depend on blocked requests, authentication, timers, or conditions that never resolve. Combine a suitable timeout with a virtual-time budget where needed and verify the runtime’s network access.

What should I do if an old script still contains –headless=old?

Check the browser milestone first. From M132 that mode is no longer in the Chrome binary. If the workflow truly requires old-headless behavior, migrate to the supported chrome-headless-shell artifact and pin the build rather than depending on the obsolete switch.

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.