PageRenderAsBytes Method (Int32, Int32, Rectangle, RenderingSettings, ErrorLogger)

Apitron PDF Rasterizer help
Apitron.PDF.Rasterizer library for .NET
Renders the specified page to an image represented by array of bytes with pixel format BGRA8888(hence a pixel takes 4 bytes), the stride width would be desiredWidth*4 in this case.

Namespace:  Apitron.PDF.Rasterizer
Assembly:  Apitron.PDF.Rasterizer (in Apitron.PDF.Rasterizer.dll) Version: 3.0.154.0 (3.0.154.0)
Syntax

public byte[] RenderAsBytes(
	int desiredWidth,
	int desiredHeight,
	Rectangle cropBox,
	RenderingSettings settings,
	ErrorLogger errorLogger = null
)

Parameters

desiredWidth
Type: SystemInt32
Width of the resulting image, should be greater than zero.
desiredHeight
Type: SystemInt32
Height of the resulting image, should be greater than zero.
cropBox
Type: Apitron.PDF.RasterizerRectangle
The crop box defines the region to which the contents of the page shall be clipped (cropped) when rendered.
settings
Type: Apitron.PDF.Rasterizer.ConfigurationRenderingSettings
The rendering settings, can't be null.
errorLogger (Optional)
Type: Apitron.PDF.Rasterizer.ErrorHandlingErrorLogger
An optional error logger object.

Return Value

Type: Byte
A bitmap representing content of the page, any errors encountered will be logged to errorLogger if present. If rendering fails null will be returned.
Exceptions

ExceptionCondition
ArgumentException If desiredWidth or desiredHeight is zero or less.
ArgumentNullException If settings is null.
See Also

Reference