how to get block coordinates

  • 1.8K Views
  • Last Post 26 November 2013
vbknight posted this 25 November 2013

how can i get all the block coordinates of my image file(pdf)?

Order By: Standard | Newest | Votes
vbknight posted this 26 November 2013

Using FineReader 11 SDK.


I was able to get the blocks type and coordinateS by using below procedure. Passing loaded document layout.


    private void GetCoordinates(FREngine.ILayout layout)
    {
        foreach (FREngine.IBlock block in layout.Blocks)
        {
            if (block.Type == FREngine.BlockTypeEnum.BT_VectorPicture)
            {
                FREngine.FRRectangle coor = block.Region.BoundingRectangle;
                //left, top, right, bottom
                coordinate = "<block x1='" + coor.Left + "' y1='" + coor.Top + "' x2='" + coor.Right + "' x2='" + coor.Bottom + "'";

            }
            if (block.Type == FREngine.BlockTypeEnum.BT_RasterPicture)
            {
                FREngine.FRRectangle coor = block.Region.BoundingRectangle;
                //left, top, right, bottom
                coordinate = "<segment pageid='' x1='" + coor.Left + "' y1='" + coor.Top + "' x2='" + coor.Right + "' x2='" + coor.Bottom + "'>";

            }
            if (block.Type == FREngine.BlockTypeEnum.BT_Text) {

                FREngine.ITextBlock textBlock = block.GetAsTextBlock();
                //int iPar = textBlock.Text.Paragraphs.Count;
                foreach (FREngine.IParagraph para in textBlock.Text.Paragraphs) {
                    content = para.Text.ToString();    
                }
            }
        }
    }

codedby #J3553#

Anastasia Galimova posted this 26 November 2013

please specify the product

Close