
'Declaration Public Class GetTextOrientationCommand Inherits Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
public class GetTextOrientationCommand : Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
public __gc class GetTextOrientationCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
public ref class GetTextOrientationCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
' [ do not forget to set your image file path here! ] Dim filepath As String = "Document.tif" ' create the command Dim command As New Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommand() ' initialize command results command.Results = New Vintasoft.Imaging.ImageProcessing.ProcessingCommandResults() Try Using image As New Vintasoft.Imaging.VintasoftImage(filepath) ' execute the command command.ExecuteInPlace(image) End Using Catch ex As Vintasoft.Imaging.ImageProcessing.ImageProcessingException ' show error message if problem occured System.Windows.Forms.MessageBox.Show(ex.Message) Return End Try ' get command result Dim result As Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommandResult = DirectCast(command.Results(0), Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommandResult) Dim documentOrientation As Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation = result.Orientation ' show orientation determining result Select Case documentOrientation Case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Undefined System.Windows.Forms.MessageBox.Show(System.[String].Format("Document orientation is not defined.")) Exit Select Case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated0 System.Windows.Forms.MessageBox.Show(System.[String].Format("Document has the right orientation.")) Exit Select Case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated90 System.Windows.Forms.MessageBox.Show(System.[String].Format("Document is rotated by 90 degrees clockwise.")) Exit Select Case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated180 System.Windows.Forms.MessageBox.Show(System.[String].Format("Document is rotated by 180 degrees clockwise.")) Exit Select Case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated270 System.Windows.Forms.MessageBox.Show(System.[String].Format("Document is rotated by 270 degrees clockwise.")) Exit Select Case Else Throw New System.NotImplementedException() End Select
// [ do not forget to set your image file path here! ] string filepath = "Document.tif"; // create the command Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommand command = new Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommand(); // initialize command results command.Results = new Vintasoft.Imaging.ImageProcessing.ProcessingCommandResults(); try { using (Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage(filepath)) { // execute the command command.ExecuteInPlace(image); } } catch (Vintasoft.Imaging.ImageProcessing.ImageProcessingException ex) { // show error message if problem occured System.Windows.Forms.MessageBox.Show(ex.Message); return; } // get command result Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommandResult result = (Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommandResult)command.Results[0]; Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation documentOrientation = result.Orientation; // show orientation determining result switch (documentOrientation) { case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Undefined: System.Windows.Forms.MessageBox.Show(System.String.Format("Document orientation is not defined.")); break; case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated0: System.Windows.Forms.MessageBox.Show(System.String.Format("Document has the right orientation.")); break; case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated90: System.Windows.Forms.MessageBox.Show(System.String.Format("Document is rotated by 90 degrees clockwise.")); break; case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated180: System.Windows.Forms.MessageBox.Show(System.String.Format("Document is rotated by 180 degrees clockwise.")); break; case Vintasoft.Imaging.ImageProcessing.Info.ImageOrthogonalOrientation.Rotated270: System.Windows.Forms.MessageBox.Show(System.String.Format("Document is rotated by 270 degrees clockwise.")); break; default: throw new System.NotImplementedException(); }
System.Object
Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
Vintasoft.Imaging.ImageProcessing.Info.GetTextOrientationCommand
Target Platforms: .NET 5; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5