C1TextSearchManager to get text in a rectangle

Posted by: abel.perez on 28 June 2019, 12:25 pm EST

    • Post Options:
    • Link

    Posted 28 June 2019, 12:25 pm EST

    Im using the sample using C1TextSearchManager to search a PDF. Each hit results in a C1FoundPosition. This object has a NearText field which is the text in the vicinity of the search text. It also has a GetBounds field where the text was found.

    How can I use GetBounds to get the entire text in that rectangle where the text was found?

  • Posted 2 July 2019, 7:04 am EST

    Hello,

    GetBounds method returns the bounds of the text we are searching for. As we are already aware of the text being searched (because that is how we add it to the search parameters), please inform regarding your use-case based on which you intend to find the same text via GetBounds.

    We are actually getting the bounds from the knowledge of the text itself so if you can elaborate on the requirement, I might be able to assist you better.

    Thanks,

    Esha

  • Posted 2 July 2019, 2:47 pm EST - Updated 4 October 2022, 1:05 am EST

    So using the PDF search sample I have the output that says it found the key word “usable length”. It tells me the bounds and the NearText. The document displayed underneath the form is the actual PDF and if I go into edit mode i can see there is a box that contains the entire text “Reindexed, runway bearings, usable length.” The entire text in that box is what I am looking for.

  • Posted 3 July 2019, 5:07 am EST

    Hello,

    When the PDF is opened in edit mode, rectangular blocks are shown around each text string by default to enable editing. This is not related to the search being performed in the PDF via the API.

    I used the SearchText sample (at the default location: Documents\ComponentOne Samples\WinForms\C1Document\CS\SearchText) and followed the steps you have mentioned. Refer the attached gif showing that the text being searched already has a rectangular block around it, before the search is performed.

    Thanks,

    Esha

    C1PdfDocumentSource.zip

  • Posted 3 July 2019, 2:40 pm EST - Updated 4 October 2022, 1:05 am EST

    Ok so what I am trying to is locate some text and then once I find it get all the text in that rectangle. I understand that the API finds the text near the search term but it has to know what rectangle its in doesn’t it? From there we can ask the API to get all text in that rectangle.

  • Posted 5 July 2019, 3:21 am EST

    Hello,

    The NearText is not obtained using the complete bounds of the string but by text trimming around the searched text and hence, it is not obtained based on the bounds.

    Thus, it is not possible to fetch the entire content of the region as you expect.

    Let me know if you need assistance over any other issue.

    Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels