The following example demonstrates how to save a document using SaveOptions.
using(Redactorredactor=newRedactor(@"C:\sample.pdf")){// Document redaction goes here// ...// Save the document with default options (convert pages into images, save as PDF)redactor.Save();// Save the document in original format overwriting original fileredactor.Save(newSaveOptions(){AddSuffix=false,RasterizeToPDF=false});// Save the document to "*_Redacted.*" file in original formatredactor.Save(newSaveOptions(){AddSuffix=true,RasterizeToPDF=false});// Save the document to "*_AnyText.*" (e.g. timestamp instead of "AnyText") in its file name without rasterizationredactor.Save(newSaveOptions(false,"AnyText"));}
Options to rasterize or not and to specify pages for rasterization
Examples
The following example demonstrates how to set options for the rasterization process.
using(varredactor=newRedactor("SomePresentation.pptx")){// redact sensitive data on the first slide varrasterizationOptions=newRasterizationOptions();rasterizationOptions.PageIndex=0;rasterizationOptions.PageCount=1;rasterizationOptions.Compliance=PdfComplianceLevel.PdfA1a;using(varstream=File.Open(Path.Combine(@"C:\Temp","PresentationFirstSlide.pdf"))){redactor.Save(stream,rasterizationOptions);}}