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")
NuGet Download
Install-Package 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.8just released

Key in blue circle

Get your free 30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
  • 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 related to IronPDF Product Demo

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