Recognizing Pages with Multiple Text Orientations

You can recognize pages that contain text with different orientations.

Solution
  1. Create text blocks for the text in the image.
  2. Specify the text orientation using TextOrientation object.
  3. Call the Recognize method of the FRDocument object.

C# sample:

//add your image to the FRDocument
string imagePath = @"D:\various_orientation.png";
document.AddImageFile(imagePath, null, null);

//create regions that correspond to the text
FREngine.Region verticalRegion = engineLoader.Engine.CreateRegion();
verticalRegion.AddRect(40,60,126,584);
FREngine.Region horizontalRegion = engineLoader.Engine.CreateRegion();
horizontalRegion.AddRect(300,100,700,400);

//add text blocks to document layout
document.Pages[0].Layout.AddBlock(FREngine.BlockTypeEnum.BT_Text, horizontalRegion);
document.Pages[0].Layout.AddBlock(FREngine.BlockTypeEnum.BT_Text, verticalRegion);

//specify orientation for vertical text
FREngine.TextOrientation textOrientation = engineLoader.Engine.CreateTextOrientation();
textOrientation.RotationType = FREngine.RotationTypeEnum.RT_Counterclockwise;
document.Pages[0].Layout.Blocks[1].GetAsTextBlock().TextOrientation = textOrientation;

//recognize, synthesize, export
document.Recognize();
document.Synthesize();
document.Export(@"D:\exp.rtf", FREngine.FileExportFormatEnum.FEF_RTF, null);

To run this sample you can insert the code above into the try block of the processImage method in C# Hello sample and specify the path to the attached image.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Recently viewed