Another approach, you can get the left/right and up/down word possission trends to determine what the orientation should be and then compare that with the pInfo.ImageRotationAngle. If the angles don't match, then rotate to correct angle.
For Each pInfo As PageInfo In PageReader
If pInfo.HasWordLocations Then
' Get all word location data for the page
Using WordLocations As WordLocationsReader = pInfo.ReadLocationsPagePart()
Dim iTop As Integer = 0
Dim iLeft As Integer = 0
Dim UpDown As Integer = 0
Dim LeftRight As Integer = 0
Dim iRotation As Integer = 0
' Create a buffer to hold all location rectangles from page
Dim AllRects(WordLocations.WordLocationCount - 1) As Common.LfRectangle
' Get all location rectangles from page
WordLocations.Read(AllRects, 0, AllRects.Count)
' Process each rectangle
For Each Rect As Common.LfRectangle In AllRects
' Get possission trend (do rectangles move top to bottom or vise-versa)
If Rect.Top > iTop Then
UpDown = UpDown + 1
ElseIf Rect.Top < iTop Then
UpDown = UpDown - 1
Else
' if Rect.Top = iTop then there is no up/down
End If
' Save top value for comparison with next object
iTop = Rect.Top
' Get possission trend (do rectangles move Left to Right or vise-versa)
If Rect.Left > iLeft Then
LeftRight = LeftRight + 1
ElseIf Rect.Left < iLeft Then
LeftRight = LeftRight - 1
Else
' If Rect.Left = iLeft then there is no Left/Right
End If
' Save Left value for comparison with next object
iLeft = Rect.Left
Next
' Use possition movement trends to determin oriantation
If UpDown > 0 Then
If LeftRight > 0 Then
'Image rotation = 0
iRotation = 0
ElseIf LeftRight < 0 Then
'Image rotation = 270
iRotation = 270
Else
' Image rotation = 270
iRotation = 270
End If
ElseIf UpDown < 0 Then
If LeftRight > 0 Then
' Image rotation = 90
iRotation = 90
ElseIf LeftRight < 0 Then
' Image rotation = 180
iRotation = 180
Else
' Left/Right Trend = 0 - Too little text
' Unknown image rotation (I think it is 90, but need to do more testing)
iRotation = 90
End If
Else
' Up/Down Trend = 0 - Too little text
If LeftRight > 0 Then
' Unknown image rotation (I think it is 0, but need to do more testing)
iRotation = 0
ElseIf LeftRight < 0 Then
' Image rotation = 180
iRotation = 180
Else
' Unknown image rotation (I think it is 0, but need to do more testing)
iRotation = 0
End If
End If
' Rotate image based on possission trends
' If image rotation does not match trend, rotate
If pInfo.ImageRotationAngle <> iRotation Then
pInfo.ImageRotationAngle = iRotation
pInfo.Save()
End If
End Using
End If
Next