Home / Frequently Asked Questions / View

Is there a way to extract PDF text only from specific coordinates?

Yes, PDFTextStream can be used to extract content from specified coordinates on one or many pages in a document.

RegionOutputTarget is an OutputHandler implementation that allows you to define areas on a page where the desired content is positioned.  Once a page is piped through the RegionOutputTarget instance, the content found in the specified regions is then available from the RegionOutputTarget, optionally mapped to user-defined names.

This is particularly handy for extracting form data where each field is known to be positioned in a specific location (perhaps on a specific page in each document of a particular type): each form fields' coordinates can be defined in the RegionOutputTarget and given a name ("address" or "ID No." or "field-553" -- whatever is appropriate for your application).  Then that RegionOutputTarget can be queried for the text values of those fields after a PDF Page has been piped through it.

Some example code is available on RegionOutputTarget's API reference page.

What's your PDF problem?