Please choose a menu option
Visit the IDRsolutions WebSite

PDF Search in a file

Description Search PDF files for text.
Jar Path org.jpedal.examples.text.FindTextInRectangle

Click for source code link

How to run the code

Windows: java -cp %jpedalDir%/jpedal.jar org/jpedal/examples/text/FindTextInRectangle inputValues
MacOS X Linux: java -cp $jpedalDir/jpedal.jar org/jpedal/examples/text/FindTextInRectangle inputValues

Click here for help on running Java programs from the command line

 

An explanation of the input values

This example expects two space delimited input values as well as two optional values.

-c (optional): This optional flag prevents the results of the search being shown on the console
Search Path: The filename (including the path if needed) or a directory containing files. If it contains spaces it must be enclosed by double quotes (ie "C:/Path with spaces/").
Target string: This is the unicode text string to find.
XML file path (optional): The path to where an optionial XML file of the search results will be created, overwriting an exisiting file if it already exists.

 

Description

Finds the location of every instance of a string on each page of a given Pdf file or directory of files. Searching starts from the top left corner and scans down the page, left to right. A simple XML file can be produced showing the results of the search.

 

Screenshot

Command line PDF text search

Console output

 

XML file of PDF search

Simple XML output

 

Links to related articles

Search options describes the PDF search facilities JPedal offers to developers
Getting started tutorial
SimpleViewer - includes a comprehensive PDF search function.
Additional optional libraries lists items which may be needed for some PDF files or functionality.

 

Return to main PDF support section

Click here for the main PDF support area with lots of java examples, PDF tutorials and useful information to get the most out of the JPedal PDF library

 


PDF viewer