How to extract text in given area?

Hi, Support:

Is there method to extract the text from given rectangle area in a given page in pdf ? for example, please refer to the demo pdf shown as image indicated by the red rectangle, and the extracted text must be “putongbi-random-1pc”.

111.jpg (104.5 KB)

@ducaisoft

Yes, you can extract text from a PDF by specifying particular region. Please check the below example article in the API documentation and let us know if you face any issues:

Thanks very much.
Another issue is that it is very difficult to specify the right position (x,y,w,h) for the rectangle,because the normal (x,y)=(0,0) refer to the left-top conner, and the (w,h) refer to the bottom-right conner, but actually the (x,y)=(0,0) does not refer to the left-top conner for the PDF API.

@ducaisoft

Yes, because Aspose.PDF follows the coordinating system where (0,0) means bottom-left corner.
You can share the coordinates that you are trying and we will see if we can use them to extract desired text from PDF using the API.