# IPdfPageRasterizer interface

> Renders a page to pixels for OCR, for pages PdfOcr cannot read from their images. PdfNetStack does not render; an application supplies a renderer, for...

Namespace: [PdfNetStack.Ocr](https://www.jadev-corp.com/api/pdfnetstack-ocr/)  
Assembly: PdfNetStack.Ocr.dll  
Package: `PdfNetStack.Ocr`

Renders a page to pixels for OCR, for pages [PdfOcr](https://www.jadev-corp.com/api/pdfnetstack-ocr/pdfocr/) cannot read from their images.
PdfNetStack does not render; an application supplies a renderer, for example one built on
PDFium, through [Rasterizer](https://www.jadev-corp.com/api/pdfnetstack-ocr/pdfocroptions/#PdfNetStack_Ocr_PdfOcrOptions_Rasterizer).

```csharp
public interface IPdfPageRasterizer
```

## Methods

### <a id="PdfNetStack_Ocr_IPdfPageRasterizer_Render_PdfNetStack_PdfPage_System_Int32_System_Double_System_Threading_CancellationToken_"></a> Render\(PdfPage, int, double, CancellationToken\)

Renders a page as it is shown: its crop box, turned clockwise by its /Rotate, on white.
Called one page at a time, on the thread running [PdfOcr](https://www.jadev-corp.com/api/pdfnetstack-ocr/pdfocr/), before the page's
text layer is added, so a renderer may also read the original file at
<code class="paramref">pageIndex</code>.

```csharp
OcrBitmap? Render(PdfPage page, int pageIndex, double dpi, CancellationToken cancellationToken)
```

#### Parameters

`page` [PdfPage](https://www.jadev-corp.com/api/pdfnetstack/pdfpage/)

The page.

`pageIndex` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Its zero based index in the document.

`dpi` [double](https://learn.microsoft.com/dotnet/api/system.double)

The resolution to render at, in pixels per inch; already lowered to keep the page within [MaxImagePixels](https://www.jadev-corp.com/api/pdfnetstack-ocr/pdfocroptions/#PdfNetStack_Ocr_PdfOcrOptions_MaxImagePixels).

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

Stops the rendering.

#### Returns

 [OcrBitmap](https://www.jadev-corp.com/api/pdfnetstack-ocr/ocrbitmap/)?

The page in 8 bit gray, or null to leave it unread.

## Used in

- [Make scanned PDFs searchable with OCR in C#](https://www.jadev-corp.com/guides/ocr/)

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-ocr/ipdfpagerasterizer/
