RedactorGeneratePreview Method
Generates preview images of specific pages in a given image format.

Namespace: GroupDocs.Redaction
Assembly: GroupDocs.Redaction (in GroupDocs.Redaction.dll) Version: 21.3
Syntax
public void GeneratePreview(
	PreviewOptions previewOptions
)

Parameters

previewOptions
Type: GroupDocs.Redaction.OptionsPreviewOptions
Image properties and page range settings

Implements

IPreviewableGeneratePreview(PreviewOptions)
Examples

The following example demonstrates how get a document preview using PreviewOptions and both delegates.

C#
CreatePageStream createDelegate = delegate (int pageNumber)
{
    var pagePath = System.IO.Path.Combine(@"C:\Temp", string.Format("page_{0}.png", pageNumber));
    return System.IO.File.Create(pagePath);
};
ReleasePageStream releaseDelegate = delegate (int pageNumber, System.IO.Stream pageStream)
{
    // do anything with Stream, containing page preview
    pageStream.Close();
};
var previewOptions = new PreviewOptions(createDelegate, releaseDelegate);
previewOptions.PreviewFormat = PreviewOptions.PreviewFormats.PNG;
previewOptions.Height = 640;
previewOptions.Width = 480;
previewOptions.PageNumbers = new int[] { 1 };
using (var redactor = new Redactor("C:\Temp\SourceFile.pdf"))
{
    redactor.GeneratePreview(previewOptions);
}
See Also