In order to use the advanced rasterization options you have to pass one of the options to Save method. In this case the document will be rasterized to PDF, but the scan-like effects will be applied to its pages.
importgroupdocs.redactionasgrimportgroupdocs.redaction.optionsasgroimportgroupdocs.redaction.redactionsasgrrdefrun():# Specify the redaction optionsrepl_opt=grr.ReplacementOptions("[personal]")ex_red=grr.ExactPhraseRedaction("John Doe",repl_opt)# Load the document to be redactedwithgr.Redactor("source.docx")asredactor:# Apply the redactionresult=redactor.apply(ex_red)# Save the document with advanced options (convert pages into images, and save PDF with scan-like pages)so=gro.SaveOptions()so.rasterization.enabled=Trueso.redacted_file_suffix="_scan"so.rasterization.add_advanced_option(gro.AdvancedRasterizationOptions.BORDER)so.rasterization.add_advanced_option(gro.AdvancedRasterizationOptions.NOISE)so.rasterization.add_advanced_option(gro.AdvancedRasterizationOptions.GRAYSCALE)so.rasterization.add_advanced_option(gro.AdvancedRasterizationOptions.TILT)redactor.save(so)
Use grayscale rasterization option
The following example demonstrates how to apply the grayscale advanced rasterization option.
Python
importgroupdocs.redactionasgrimportgroupdocs.redaction.optionsasgroimportgroupdocs.redaction.redactionsasgrrdefrun():# Load the document to be redactedwithgr.Redactor("source.docx")asredactor:# Save the document with the custom grayscale effectso=gro.SaveOptions()so.rasterization.enabled=Trueso.redacted_file_suffix="_scan"so.rasterization.add_advanced_option(gro.AdvancedRasterizationOptions.GRAYSCALE)result_path=redactor.save(so)
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to perform redactions for various document formats like PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Redaction App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.