Options used by PageRenderer.
For a list of all members of this type, see RenderOptions Members.
System.Object
Aspose.Editor.Desktop.RenderOptions
[Visual Basic]
Public Class RenderOptions
[C#]public class RenderOptions
Example
Renders all pages of the document into thumbnails 400x400 pixels.
[C#]
Document doc = new Document(MyPath + "Welcome.xml");
PageRenderer renderer = new PageRenderer(doc);
// These are the parameters we want for rendering.
const int maxWidth = 400;
const int maxHeight = 400;
renderer.Options.IsShowControlCharacters = true;
renderer.Options.IsShowPageBorders = true;
for (int pageIndex = 0; pageIndex < renderer.PageCount; pageIndex++)
{
// Create the bitmap that will hold the image. Make sure to dispose it at the end.
Bitmap bitmap = new Bitmap(maxWidth, maxHeight);
try
{
Graphics gfx = Graphics.FromImage(bitmap);
try
{
// You can specify various settings on the Graphics object to control the output.
gfx.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
// Fill the page with "paper color", otherwise it will remain transparent.
gfx.Clear(Color.Azure);
// Render the page onto the graphics no exceeding the specified size.
renderer.Render(pageIndex, gfx, 0, 0, maxWidth, maxHeight);
}
finally
{
gfx.Dispose();
}
// Save the bitmap into a file.
string fileName = string.Format(MyPath + "ExPageRenderer.RenderToSize{0} Out.png", pageIndex);
bitmap.Save(fileName, ImageFormat.Png);
}
finally
{
bitmap.Dispose();
}
}
[Visual Basic]
Dim doc As New Document(MyPath & "Welcome.xml")
Dim renderer As New PageRenderer(doc)
' These are the parameters we want for rendering.
Const maxWidth As Integer = 400
Const maxHeight As Integer = 400
renderer.Options.IsShowControlCharacters = True
renderer.Options.IsShowPageBorders = True
For pageIndex As Integer = 0 To renderer.PageCount - 1
' Create the bitmap that will hold the image. Make sure to dispose it at the end.
Dim bitmap As New Bitmap(maxWidth, maxHeight)
Try
Dim gfx As Graphics = Graphics.FromImage(bitmap)
Try
' You can specify various settings on the Graphics object to control the output.
gfx.TextRenderingHint = TextRenderingHint.AntiAliasGridFit
' Fill the page with "paper color", otherwise it will remain transparent.
gfx.Clear(Color.Azure)
' Render the page onto the graphics no exceeding the specified size.
renderer.Render(pageIndex, gfx, 0, 0, maxWidth, maxHeight)
Finally
gfx.Dispose()
End Try
' Save the bitmap into a file.
Dim fileName As String = String.Format(MyPath & "ExPageRenderer.RenderToSize{0} Out.png", pageIndex)
bitmap.Save(fileName, ImageFormat.Png)
Finally
bitmap.Dispose()
End Try
Next pageIndexRequirements
Namespace: Aspose.Editor.Desktop
Assembly: Aspose.Editor.Desktop (in Aspose.Editor.Desktop.dll)
See Also
RenderOptions Members | Aspose.Editor.Desktop Namespace