---
title: "Rotate pages in a multipage TIFF using OCR and VB.NET"
canonical_url: "https://www.nutrient.io/guides/dotnet/samples/auto-rotate-tiff-vbnet/"
md_url: "https://www.nutrient.io/guides/dotnet/samples/auto-rotate-tiff-vbnet.md"
last_updated: "2026-05-21T17:12:02.215Z"
description: "Learn how to automatically rotate multipage TIFF files using the Tesseract OCR engine in VB.NET. Save the rotated file effortlessly with our example."
---

# Automatically rotate pages of a multipage TIFF file using OCR and VB.NET

This example shows how to automatically rotate pages of a multipage TIFF file with help of the OCR Tesseract engine method. After the successful rotation of all pages, the source file is saved to the destination file.

[Get Started](https://www.nutrient.io/sdk/dotnet/getting-started.md)

[All Samples](https://www.nutrient.io/guides/dotnet/samples.md)

[Download](https://www.nutrient.io/guides/dotnet/downloads.md)

[Launch Demo](https://www.nutrient.io/demo/)

---

### C#

[C#](https://www.nutrient.io/guides/dotnet/samples/auto-rotate-tiff-cs.md)

### VB.NET

[VB.NET](https://www.nutrient.io/guides/dotnet/samples/auto-rotate-tiff-vbnet.md)

```vb

'We assume that GdPicture has been correctly installed and unlocked.
Dim filepath As String = "multipage.tif"
Dim destpath As String = "output.tif"
'Specify your path.
Dim DICT_PATH As String = "C:\GdPicture.NET 14\Redist\OCR"
'Specify your language.
Dim LANG As OCRLanguage = OCRLanguage.English

Dim status As GdPictureStatus
Using gdpictureImaging As New GdPictureImaging()
    Dim hasRotation As Boolean = False
    Dim imageID As Integer = gdpictureImaging.CreateGdPictureImageFromFile(filepath)
    status = gdpictureImaging.GetStat()
    If status = GdPictureStatus.OK Then
        Dim pageCount As Integer = gdpictureImaging.GetPageCount(imageID)
        For i As Integer = 1 To pageCount
            status = gdpictureImaging.SelectPage(imageID, i)
            If status = GdPictureStatus.OK Then
                Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
                    gdpictureOCR.ResourceFolder = DICT_PATH
                    gdpictureOCR.AddLanguage(LANG)
                    status = gdpictureOCR.SetImage(imageID)
                    Dim pageRotation As Integer = gdpictureOCR.GetOrientation()
                    If pageRotation <> 0 Then
                        hasRotation = True
                        status = gdpictureImaging.RotateAngle(imageID, 360 - pageRotation)
                    End If
                End Using
            End If
            If status <> GdPictureStatus.OK Then
                MessageBox.Show("Error: " + status, "Rotation + OCR Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit For
            End If
        Next
        If status = GdPictureStatus.OK Then
            If hasRotation Then
                status = gdpictureImaging.TiffSaveMultiPageToFile(imageID, destpath, TiffCompression.TiffCompressionAUTO)
                If status = GdPictureStatus.OK Then
                    MessageBox.Show("Done!", "Rotation + OCR Example", MessageBoxButtons.OK, MessageBoxIcon.Information)
                Else
                    MessageBox.Show("Error: " + status, "Rotation + OCR Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
                End If
            Else
                System.IO.File.Copy(filepath, destpath)
            End If
        End If
        gdpictureImaging.ReleaseGdPictureImage(imageID)
    End If
End Using

```

This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.

---

## Related pages

- [Saving images into folders based on their barcode](/guides/dotnet/samples/barcode-auto-sorting-vbnet.md)
- [Automatically rotate pages of a multipage TIFF file using OCR and C#](/guides/dotnet/samples/auto-rotate-tiff-cs.md)
- [Generate a multipage TIFF file using a compression mode per page in C#](/guides/dotnet/samples/create-multipage-tiff-cs.md)
- [Saving images into folders based on their barcode](/guides/dotnet/samples/barcode-auto-sorting-cs.md)
- [Converting a Microsoft Word binary file document (DOC) to a Microsoft Word OpenXML document (DOCX) in C#](/guides/dotnet/samples/doc-to-docx-cs.md)
- [Convert PDFs, MS Office, and images to TIFF in C#](/guides/dotnet/samples/convert-to-tiff-cs.md)
- [Using an external OCR engine during PDF/OCR generation](/guides/dotnet/samples/integrate-omnipage-ocr-cs.md)
- [Merging two PDF documents by alternating pages from both files in C#](/guides/dotnet/samples/merge-pdf-alternate-pages-cs.md)
- [Merging two PDF documents by alternating pages from both files in VB.NET](/guides/dotnet/samples/merge-pdf-alternate-pages-vbnet.md)
- [Recompress an existing PDF using color detection in C#](/guides/dotnet/samples/recompress-pdf-cs.md)
- [Converting a multipage PDF to a multipage TIFF using color detection in C#](/guides/dotnet/samples/pdf-to-tiff-color-detection-cs.md)
- [Converting a multipage PDF to a multipage TIFF using color detection in VB.NET](/guides/dotnet/samples/pdf-to-tiff-color-detection-vbnet.md)
- [Recompress existing PDFs using MRC compression in C#](/guides/dotnet/samples/recompress-pdf-mrc-cs.md)
- [Recompress existing PDFs using MRC compression in VB.NET](/guides/dotnet/samples/recompress-pdf-mrc-vbnet.md)
- [Highlight and crop an image in C#](/guides/dotnet/samples/select-image-crop-area-cs.md)
- [Recompress an existing PDF using color detection in VB.NET](/guides/dotnet/samples/recompress-pdf-vbnet.md)
- [Highlight and crop an image in VB.NET](/guides/dotnet/samples/select-image-crop-area-vbnet.md)
- [Highlight a region in a PDF or an image in C#](/guides/dotnet/samples/select-pdf-image-region-cs.md)
- [Highlight a region in PDF or an image in VB.NET](/guides/dotnet/samples/select-pdf-image-region-vbnet.md)
- [Save bitonal TIFFs with VB.NET using photometric 0](/guides/dotnet/samples/tiff-photometric-vbnet.md)
- [Choosing the appropriate OCR zone in C#](/guides/dotnet/samples/select-ocr-zone-cs.md)
- [Save bitonal TIFF images with C# and CCITT4](/guides/dotnet/samples/tiff-photometric-cs.md)
- [Choosing the appropriate OCR zone in VB.NET](/guides/dotnet/samples/select-ocr-zone-vbnet.md)
- [Convert a multipage TIFF to a multipage JBIG2 in C#](/guides/dotnet/samples/tiff-to-jbig2-cs.md)
- [Convert a multipage TIFF to a multipage JBIG2 in VB.NET](/guides/dotnet/samples/tiff-to-jbig2-vbnet.md)

