AdvancedRasterizationOptions

AdvancedRasterizationOptions enumeration

Flags enumeration to manage the advanced rasterization options to be applied.

public enum AdvancedRasterizationOptions

Values

Name Value Description
None 0 No advanced options to apply.
Tilt 1 Tilt to incline the rasterized image to a random angle.
Noise 2 Add random spots to rasterized page images.
Border 4 Add border line to imitate page scan effect.
Grayscale 8 Make page images grayscale to imitate grayscale scan.

Examples

The following example demonstrates how to apply the advanced rasterization options with default settings.

    using (Redactor redactor = new Redactor(@"C:\sample.docx"))
    {
      // Save the document with default options (convert pages into images, save as PDF)
      var so = new SaveOptions();
      so.Rasterization.Enabled = true;
      so.RedactedFileSuffix = "_scan";
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Border);
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Noise);
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Grayscale);
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Tilt);
      redactor.Save(so);
    }

The following example demonstrates how to apply the border advanced rasterization option with custom settings.

    using (Redactor redactor = new Redactor(@"C:\sample.docx"))
    {
      // Save the document with a custom border
      var so = new SaveOptions();
      so.Rasterization.Enabled = true;
      so.RedactedFileSuffix = "_scan";
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Border, new Dictionary<string, string>() { { "border", "10" } });
      redactor.Save(so);
    }

The following example demonstrates how to apply the noise advanced rasterization option with custom settings.

    using (Redactor redactor = new Redactor(@"C:\sample.docx"))
    {
      // Save the document with the custom number and size of noise effects
      var so = new SaveOptions();
      so.Rasterization.Enabled = true;
      so.RedactedFileSuffix = "_scan";
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Noise, 
          new Dictionary<string, string>() { { "maxSpots", "150" }, { "spotMaxSize", "15" } });
      redactor.Save(so);
    }

The following example demonstrates how to apply the tilt advanced rasterization option with custom settings.

    using (Redactor redactor = new Redactor(@"C:\sample.docx"))
    {
      // Save the document with the custom tilt effect
      var so = new SaveOptions();
      so.Rasterization.Enabled = true;
      so.RedactedFileSuffix = "_scan";
      so.Rasterization.AddAdvancedOption(AdvancedRasterizationOptions.Tilt, 
          new Dictionary<string, string>() { { { "minAngle", "85" }, { "randomAngleMax", "5" } });
      redactor.Save(so);
    }

See Also