IRONSOFTWAREHOME
Set to Grayscale
from ironpdf import *

renderer = ChromePdfRenderer()

# Set Color and Grayscale
renderer.RenderingOptions.GrayScale = True

renderer.RenderHtmlFileAsPdf("my-content.html").SaveAs("my-content.pdf")
pip install ironpdf
Set to Grayscale

Set to Grayscale

IronPDF for Python can render PDFs entirely in grayscale by setting a single property on RenderingOptions, converting all colors in the source HTML to shades of gray in the output.

Getting Started

Set RenderingOptions.GrayScale = True on a ChromePdfRenderer instance before calling any render method. All subsequent PDFs produced by that renderer will be rendered in grayscale.

Understanding the Code

  • GrayScale = True: Instructs IronPDF to convert all colors in the rendered output to grayscale. This applies to text, backgrounds, borders, images, and any other colored elements in the HTML source.
  • RenderHtmlFileAsPdf("my-content.html"): Renders the local HTML file using the grayscale setting.
  • SaveAs("my-content.pdf"): Saves the grayscale PDF to disk.

Use Cases

Grayscale rendering is useful when:

  • Reducing file size - grayscale PDFs are typically smaller than color equivalents.
  • Ensuring print consistency - documents intended for black-and-white printers look identical on screen and in print.
  • Meeting accessibility requirements - some accessibility standards require documents to remain legible when color is removed.

To render only specific pages in grayscale, render them separately with GrayScale = True and merge the result with full-color pages using PdfDocument.Merge.

Ready to Get Started?

Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Python Module Download for PDF
Install with pip

Version: 2026.9

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.9

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install ironpdf-2026.9-py37-none-win_amd64.whi

Licenses from $999