---
title: "C# .NET OCR driver’s licenses to text: Fast and accurate extraction | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/ocr/drivers-licenses/"
md_url: "https://www.nutrient.io/guides/dotnet/ocr/drivers-licenses.md"
last_updated: "2026-05-30T02:20:01.269Z"
description: "Learn how to use Nutrient .NET SDK’s optical character recognition (OCR) to convert scanned driver’s licenses into searchable PDFs. Streamline your document management today!"
---

# C# OCR driver’s licenses to text

This guide explains how to convert scanned driver's licenses to searchable PDFs. Nutrient.NET SDK’s (formerly GdPicture.NET) optical character recognition (OCR) engine enables you to recognize text in a driver’s license and then save the text in a PDF.

## Converting driver’s licenses to searchable PDFs

To convert a driver’s license to a searchable PDF, follow these steps:

1. Create a `GdPicturePDF` object, a `GdPictureImaging` object, and a `GdPictureOCR` object.

2. Select the scanned image of a driver’s license by passing its path to the `CreateGdPictureImageFromFile` method of the `GdPictureImaging` object.

3. Configure the OCR process with the `GdPictureOCR` object in the following way:
   - Set the image with the `SetImage` method.
   - Set the path to the OCR resource folder with the `ResourceFolder` property. The default language resources are located in `GdPicture.NET 14\Redist\OCR`. For more information on adding language resources, see the [language support](https://www.nutrient.io/guides/dotnet/ocr/language-support.md) guide.
   - With the `AddLanguage` method, add the language resources that Nutrient.NET SDK uses to recognize text in the image. This method takes a member of the `OCRLanguage` enumeration.

4. Run the OCR process with the `RunOCR` method of the `GdPictureOCR` object.

5. Get the result of the OCR process as text with the `GetOCRResultText` method of the `GdPictureOCR` object.

6. Create the output with the `CreateFromText` method of the `GdPicturePDF` object. The first parameter sets the conformance level of the PDF document. This parameter is a member of the `PdfConformance` enumeration. For example, use `PDF` to create a common PDF document.

7. Save the output in a PDF document.

The example below converts a driver’s license to a searchable PDF:

### C#

```csharp

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
using GdPictureOCR gdpictureOCR = new GdPictureOCR();
// Select the image to process.
int imageID = gdpictureImaging.CreateGdPictureImageFromFile(@"C:\temp\source.png");
// Set the OCR parameters.
gdpictureOCR.SetImage(imageID);
gdpictureOCR.ResourceFolder = @"C:\GdPicture.NET 14\Redist\OCR";
gdpictureOCR.AddLanguage(OCRLanguage.English);
// Run the OCR process.
string resID = gdpictureOCR.RunOCR();
// Get the result of the OCR process as text.
string content = gdpictureOCR.GetOCRResultText(resID);
// Save the result in a PDF document.
gdpicturePDF.CreateFromText(PdfConformance.PDF, 595, 842, 10, 10, 10, 10,
    TextAlignment.TextAlignmentNear, content, 12, "Arial", false, false, true, false);
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");
gdpictureImaging.ReleaseGdPictureImage(imageID);

```

### VB.NET

```vb

Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
    ' Select the image to process.
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile("C:\temp\source.png")
    ' Set the OCR parameters.
    gdpictureOCR.SetImage(imageID)
    gdpictureOCR.ResourceFolder = "C:\GdPicture.NET 14\Redist\OCR"
    gdpictureOCR.AddLanguage(OCRLanguage.English)
    ' Run the OCR process.
    Dim resID As String = gdpictureOCR.RunOCR()
    ' Get the result of the OCR process as text.
    Dim content As String = gdpictureOCR.GetOCRResultText(resID)
    ' Save the result in a PDF document.
    gdpicturePDF.CreateFromText(PdfConformance.PDF, 595, 842, 10, 10, 10, 10,
        TextAlignment.TextAlignmentNear, content, 12, "Arial", False, False, True, False)
    gdpicturePDF.SaveToFile("C:\temp\output.pdf")
    gdpictureImaging.ReleaseGdPictureImage(imageID)
End Using
End Using
End Using

```

#### Used methods and properties

- [`AddLanguage`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureOCR~AddLanguage.html)

- [`CreateFromText`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~CreateFromText.html)

- [`CreateGdPictureImageFromFile`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureImaging~CreateGdPictureImageFromFile.html)

- [`GetOCRResultText`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureOCR~GetOCRResultText.html)

- [`ReleaseGdPictureImage`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureImaging~ReleaseGdPictureImage.html)

- [`ResourceFolder`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureOCR~ResourceFolder.html)

- [`RunOCR`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureOCR~RunOCR\(\).html)

- [`SaveToFile`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPicturePDF~SaveToFile.html)

- [`SetImage`](/api/gdpicture/GdPicture.NET.14~GdPicture14.GdPictureOCR~SetImage.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)
---

## Related pages

- [C# OCR bank checks to text](/guides/dotnet/ocr/bank-checks.md)
- [Classify documents in C# .NET](/guides/dotnet/ocr/classify-documents.md)
- [C# OCR forms to text](/guides/dotnet/ocr/forms.md)
- [C# OCR ID cards to text](/guides/dotnet/ocr/id-cards.md)
- [C# OCR MRZ to text](/guides/dotnet/ocr/mrz.md)
- [C# OCR invoices to text](/guides/dotnet/ocr/invoices.md)
- [C# OCR passports to text](/guides/dotnet/ocr/passports.md)
- [Supported languages: 100+ OCR language dictionaries](/guides/dotnet/ocr/language-support.md)
- [C# .NET OCR library](/guides/dotnet/ocr.md)
- [C# OCR receipts to text](/guides/dotnet/ocr/receipts.md)
- [Zonal OCR in C# .NET](/guides/dotnet/ocr/zonal.md)
- [C# OCR visas to text](/guides/dotnet/ocr/visas.md)
- [Create custom OCR parameters in C#](/guides/dotnet/ocr/parameters.md)

