October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Save Selenium Pages as PDFs, Including Indian-Language Text

Selenium’s print-page command returns PDF data for the current page. Learn how to save it, configure layout, and check Indian-language rendering.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To save a page already open in Selenium as a PDF, call Selenium’s WebDriver print-page command, decode the returned Base64 data, and write the bytes to a .pdf file. In Chromium, use headless mode for printing. This creates a browser-printed PDF, not a screenshot image; choose the output method that matches what you need.

Print the current Selenium page to a PDF

Selenium’s print command operates on the page currently loaded in the browser session. The returned data is a PDF representation, which your code saves to disk. Selenium documents this workflow and print settings in its print page documentation.

Python example

Example for Selenium’s Python binding with a Chromium browser: run Chromium in headless mode, navigate to the page, wait for the content you need, then print and decode the PDF data.

import base64
from pathlib import Path

from selenium import webdriver
from selenium.webdriver.common.print_page_options import PrintOptions
from selenium.webdriver.support.ui import WebDriverWait

url = "https://example.in/"

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)
try:
    driver.get(url)

    # Replace this with a condition specific to the page you need.
    WebDriverWait(driver, 30).until(
        lambda d: d.execute_script("return document.readyState") == "complete"
    )

    print_options = PrintOptions()
    print_options.orientation = "portrait"
    print_options.background = True

    pdf_base64 = driver.print_page(print_options)
    Path("page.pdf").write_bytes(base64.b64decode(pdf_base64))
finally:
    driver.quit()

Install Selenium in the Python environment with pip install selenium. The example uses Selenium’s Python API; exact options and behavior can vary by language binding and browser build. See the Selenium API documentation for the binding you use and record your Selenium and browser versions when reproducing output.

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.

Wait for the page you actually need

document.readyState == "complete" is a useful baseline, but it does not prove that a single-page app has finished rendering, delayed images have appeared, or web fonts have loaded. Replace or extend the wait with a condition meaningful for the target page, such as a visible article element or a page-specific completion signal. There is no universal delay that guarantees all pages are ready.

Choose print settings for the PDF

Selenium’s PrintOptions supports settings for page size, orientation, margins, scale, background printing, and shrink-to-fit. Use settings to match the intended paper layout and inspect the resulting PDF rather than assuming that screen dimensions will determine pagination.

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.
  • Orientation and paper size: select portrait or landscape and a paper size suited to the page.
  • Margins: set margins when content needs more room or a consistent printable border.
  • Scale and shrink-to-fit: adjust sizing when wide content is clipped or appears too small.
  • Backgrounds: enable background printing if colored sections or background graphics are part of the information you need.

Printing can paginate or reflow content differently from the browser viewport. Review the PDF for clipping, unexpected page breaks, missing images, and missing characters.

Check Indian-language fonts and glyphs

“Indian web pages” may use different scripts, and one font choice does not cover them all. The result depends on the page’s CSS font stack, fonts available to the browser, and whether the page’s web fonts finished loading. Noto’s web-font guidance recommends selecting fonts for the writing systems in use and explains that browsers fall back through the CSS family list when a font lacks a character. Its Hindi-and-Tamil example includes Noto Sans Devanagari, Noto Sans Tamil, Noto Sans, and Noto Sans Symbols 2 (Noto web-font guidance).

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.
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.

When the PDF shows boxes or malformed text

  1. Identify the script or scripts present in the page rather than assuming all Indian-language text uses the same font.
  2. Check that the page’s web fonts have loaded before calling print_page().
  3. Check the browser environment for fonts that cover the script and the page’s CSS fallback list.
  4. Open the PDF itself and verify the affected text. A screenshot that looks correct does not establish that the PDF contains the same glyph coverage.

For a specific Linux Chromium implementation, a Chromium source change dated March 4, 2026 maps Devanagari standard and sans-serif defaults to Noto Sans Devanagari, serif to Noto Serif Devanagari, and fixed-width text to Noto Sans Mono (Chromium Linux font mapping). This is a Devanagari-specific Linux detail, not a guarantee about every Indian script, Linux image, browser build, or page. There is no one font-install command established for all platforms and scripts.

When to use Chromium DevTools instead

Selenium’s print-page API is the natural choice when you want a print abstraction through your WebDriver binding. If you need Chromium-specific controls such as header and footer templates, Chromium’s DevTools Protocol provides Page.printToPDF, with options including orientation, margins, scale, and header/footer templates (Chrome DevTools Protocol: Page.printToPDF).

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

These are different routes, not interchangeable promises of identical output. Prefer Selenium’s API for its binding-level print workflow; use the Chromium protocol when its extra Chromium-specific controls are needed and you are prepared to depend on that protocol and browser.

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

PDF versus screenshot image

A WebDriver screenshot captures an image. The print-page command produces a PDF representation of the page’s printed layout. If you need a raster image, use Selenium’s screenshot API; if you need a PDF, use the print command. Converting an image to PDF afterward is a separate step and preserves an image on a PDF page rather than producing the browser’s printed page layout. Selenium documents both printing and screenshot capture.

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.

Troubleshooting

  • Printing fails in Chromium: Selenium’s browser guidance says Chromium printing requires headless mode. Start the browser with a headless option and consult the Selenium Chrome browser documentation.
  • The PDF is blank or incomplete: the page may not have finished rendering when the print command ran. Wait for the content your workflow requires, not just a fixed delay or initial navigation.
  • Text is clipped or scaled unexpectedly: inspect page size, orientation, margins, scale, and shrink-to-fit settings, then review pagination in the PDF.
  • Background colors or images are absent: check whether background printing is enabled in the print options.
  • Indian-script text appears as boxes or is shaped incorrectly: check script-specific font coverage, CSS fallback, and web-font loading; validate the PDF directly.
  • Results differ between machines or languages: browser builds, operating systems, and Selenium bindings may use different implementations. Record the binding and browser versions and compare output under the same environment.

Or skip the browser setup

For a screenshot image or PDF through an API, ScreenshotNeo accepts one GET request with a URL. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed; and its MCP server lets AI agents take screenshots. It offers 1,000 screenshots per month free with no card, and paid plans start at $5 for 3,000. For PDF-specific options and the API details, see the ScreenshotNeo documentation.

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

Use the API’s PDF output option when you need a PDF rather than the default image output. Sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does Selenium save a PDF or an image with print_page()?

It returns PDF data. For an image capture, use Selenium’s screenshot API instead.

Does Selenium’s print-page command work in every browser?

Support and behavior depend on the browser and language binding; Chromium printing requires headless mode.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.