Convert to grayscale

On this page

To speed up the printing of a PDF file and reduce its size, you can convert it from RGB color space to grayscale.

To convert a PDF file to grayscale, set the convert_to_gray_scale property to True.

The following code snippet shows how to convert a PDF file to grayscale:

with gv.Viewer("sample.docx") as viewer:

    viewOptions = gvo.PdfViewOptions()
    viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions()
    viewOptions.pdf_optimization_options.convert_to_gray_scale = True

    viewer.view(viewOptions)

The following image demonstrates the result:

Convert to grayscale

On this page