Skip to content

# PDFPageRenderer

Namespace: O2S.Components.PDF4NET.Rendering

Defines a renderer for a PDF page.

    public class PDFPageRenderer

Inheritance Object → PDFPageRenderer

## Constructors

### PDFPageRenderer(PDFPage)

Initializes a new PDFPageRenderer object.

    public PDFPageRenderer(PDFPage page)

Parameters

`page` PDFPage
The page to be rendered on a raster surface.

## Properties

### RenderingErrors

Gets the errors that appeared during rendering.

    public PDFRenderingError[] RenderingErrors { get; }

Property Value

PDFRenderingError[]
An array of PDFRenderingError objects or null if there were no errors during rendering.

Remarks

When the PDFRendererSettings.ErrorHandling property is set to any of the "Ignore" modes then this property is filled with the errors that appeared during rendering.

## Methods

### ConvertPageToImage(PDFRendererSettings)

Converts the PDF page to an image.

    public PDFSize ConvertPageToImage(PDFRendererSettings settings)

Parameters

`settings` PDFRendererSettings
Settings for the rendering process.

Returns

PDFSize
Image size in pixels.

Remarks

A valid rendering surface must be provided in the settings parameter because the rendered page will be available only in the surface's storage.

### ConvertPageToImage(Double, Stream, PDFPageImageFormat)

Converts the PDF page to an image.

    public PDFSize ConvertPageToImage(double resolution, Stream stream, PDFPageImageFormat pageImageFormat)

Parameters

`resolution` Double
The resolution used for converting the vector PDF page to raster.

`stream` Stream
Output stream where the image will be saved.

`pageImageFormat` PDFPageImageFormat
The format used for saving the page image.

Returns

PDFSize
Image size in pixels.

### ConvertPageToImage(Stream, PDFPageImageFormat, PDFRendererSettings)

Converts the PDF page to an image.

    public PDFSize ConvertPageToImage(Stream stream, PDFPageImageFormat pageImageFormat, PDFRendererSettings settings)

Parameters

`stream` Stream
Output stream where the image will be saved.

`pageImageFormat` PDFPageImageFormat
The format used for saving the page image.

`settings` PDFRendererSettings
Settings for the rendering process.

Returns

PDFSize
Image size in pixels.

### ConvertPageToRenderList()

Coverts the page to a render list.

    public PDFRenderList ConvertPageToRenderList()

Returns

PDFRenderList
The page content as a render list.

### ConvertPageToRenderList(PDFRendererSettings)

Converts the page to a render list.

    public PDFRenderList ConvertPageToRenderList(PDFRendererSettings settings)

Parameters

`settings` PDFRendererSettings
Settings for the rendering process.

Returns

PDFRenderList
The page content as a render list.

### ConvertRenderListToImage(PDFRenderList, Stream, PDFPageImageFormat, PDFRendererSettings)

Converts the render list to an image.

    public PDFSize ConvertRenderListToImage(PDFRenderList renderList, Stream stream, PDFPageImageFormat pageImageFormat, PDFRendererSettings settings)

Parameters

`renderList` PDFRenderList
The render list to be converted.

`stream` Stream
Output stream where the image will be saved.

`pageImageFormat` PDFPageImageFormat
The format used for saving the page image.

`settings` PDFRendererSettings
Settings for the rendering process.

Returns

PDFSize
Image size in pixels.

### CreateRenderingSurface<T>(Double, Double)

Creates a rendering surface fit for rendering the current page.

    public T CreateRenderingSurface<T>(double dpiX, double dpiY)

Type Parameters

`T`
A rendering surface class.

Parameters

`dpiX` Double
The horizontal resolution used for converting the vector PDF page to raster.

`dpiY` Double
The vertical resolution used for converting the vector PDF page to raster.

Returns

T
The rendering surface

### GetImageBoxForVisual(PDFStandardRectangle, Int32, Double, Double)

Gets the size in pixels of the page when converted to image at the specified resolution.

    public static Int32[] GetImageBoxForVisual(PDFStandardRectangle pageBox, int rotation, double dpiX, double dpiY)

Parameters

`pageBox` PDFStandardRectangle
The page visible box.

`rotation` Int32
Page rotation.

`dpiX` Double
The horizontal resolution used for converting the vector PDF page to raster.

`dpiY` Double
The vertical resolution used for converting the vector PDF page to raster.

Returns

Int32[]
Image size in pixels.

### GetPageImageBox(Double, Double)

Gets the size in pixels of the page when converted to image at the specified resolution.

    public Int32[] GetPageImageBox(double dpiX, double dpiY)

Parameters

`dpiX` Double
The horizontal resolution used for converting the vector PDF page to raster.

`dpiY` Double
The vertical resolution used for converting the vector PDF page to raster.

Returns

Int32[]
Image size in pixels.

### GetPageImageSize(Double)

Gets the size in pixels of the page when converted to image at the specified resolution.

    public PDFSize GetPageImageSize(double dpi)

Parameters

`dpi` Double
The resolution used for converting the vector PDF page to raster.

Returns

PDFSize
Image size in pixels.

### GetPageImageSize(Double, Double)

Gets the size in pixels of the page when converted to image at the specified resolution.

    public PDFSize GetPageImageSize(double dpiX, double dpiY)

Parameters

`dpiX` Double
The horizontal resolution used for converting the vector PDF page to raster.

`dpiY` Double
The vertical resolution used for converting the vector PDF page to raster.

Returns

PDFSize
Image size in pixels.

### StopPageToRenderListConversion()

Stops the conversion of page content to render list launched by the PDFPageRenderer.ConvertPageToRenderList() method.

    public void StopPageToRenderListConversion()

Remarks

Used when the method PDFPageRenderer.ConvertPageToRenderList()