public class PdfGroupingAlgorithms extends Object
| Modifier and Type | Field and Description |
|---|---|
static char |
MARKER2 |
static boolean |
useUnrotatedCoords |
| Constructor and Description |
|---|
PdfGroupingAlgorithms(PdfData pdf_data,
boolean isXMLExtraction)
Create a new instance, passing in raw data
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,String> |
extractTextAsTable(int x1,
int y1,
int x2,
int y2,
int pageNumber,
boolean isCSV,
boolean keepFontInfo,
boolean keepWidthInfo,
boolean keepAlignmentInfo,
int borderWidth)
Calls various low level merging routines on merge -
|
List<String> |
extractTextAsWordlist(int x1,
int y1,
int x2,
int y2,
int page_number,
boolean breakFragments,
String punctuation)
Algorithm to place data from within coordinates to a vector of word, word coords (x1,y1,x2,y2)
|
String |
extractTextInRectangle(int x1,
int y1,
int x2,
int y2,
int page_number,
boolean estimateParagraphs,
boolean breakFragments)
Algorithm to place data from specified coordinates on a page into a String.
|
List |
findMultipleTermsInRectangle(int x1,
int y1,
int x2,
int y2,
int rotation,
String[] terms,
boolean orderResults,
int searchType,
SearchListener listener)
Algorithm to find multiple text terms in x1,y1,x2,y2 rectangle on page_number.
|
SortedMap |
findMultipleTermsInRectangleWithMatchingTeasers(int x1,
int y1,
int x2,
int y2,
int rotation,
String[] terms,
int searchType,
SearchListener listener)
Algorithm to find multiple text terms in x1,y1,x2,y2 rectangle on page_number, with matching teaser.
|
float[] |
findText(int x1,
int y1,
int x2,
int y2,
String[] terms,
int searchType)
Search a particular area with in pdf page currently loaded and return the areas
of the results found as an array of float values.
|
float[] |
findText(String[] terms,
int searchType)
Search with in pdf page currently loaded and return the areas
of the results found as an array of float values.
|
SortedMap |
findTextWithinInAreaWithTeasers(int x1,
int y1,
int x2,
int y2,
int rotation,
String[] terms,
int searchType,
SearchListener listener)
Method to search a specified area on a specified page for a search term.
|
void |
generateTeasers()
tell find text to generate teasers as well
|
String[] |
getTeasers()
return text teasers from findtext if generateTeasers() called before find
|
static String |
removeHiddenMarkers(String contents)
method to show data without encoding
|
void |
setIncludeHTML(boolean value)
sets if we include HTML in teasers
(do we want this is word or this is word as teaser)
|
public static final char MARKER2
public static boolean useUnrotatedCoords
public PdfGroupingAlgorithms(PdfData pdf_data, boolean isXMLExtraction)
pdf_data - PdfData from the pdf to searchisXMLExtraction - Boolean flag to specify if output should be xmlpublic void setIncludeHTML(boolean value)
value - true to use HTML in teasers, otherwise falsepublic static String removeHiddenMarkers(String contents)
public final Map<String,String> extractTextAsTable(int x1, int y1, int x2, int y2, int pageNumber, boolean isCSV, boolean keepFontInfo, boolean keepWidthInfo, boolean keepAlignmentInfo, int borderWidth) throws PdfException
isCSV sets if output is XHTML or CSV format -
XHTML also has options to include font tags (keepFontInfo), preserve widths (keepWidthInfo), try to preserve alignment (keepAlignmentInfo), and set a table border width (borderWidth) - AddCustomTags should always be set to false
x1 - is the x coord of the top left cornery1 - is the y coord of the top left cornerx2 - is the x coord of the bottom right cornery2 - is the y coord of the bottom right cornerpageNumber - is the page you wish to extract fromisCSV - is a boolean. If false the output is xhtml if true the text is out as CSVkeepFontInfo - if true and isCSV is false keeps font information in extrated text.keepWidthInfo - if true and isCSV is false keeps width information in extrated text.keepAlignmentInfo - if true and isCSV is false keeps alignment information in extrated text.borderWidth - is the width of the border for xhtmlPdfException - If the co-ordinates are not validpublic final List<String> extractTextAsWordlist(int x1, int y1, int x2, int y2, int page_number, boolean breakFragments, String punctuation) throws PdfException
x1 - is the x coord of the top left cornery1 - is the y coord of the top left cornerx2 - is the x coord of the bottom right cornery2 - is the y coord of the bottom right cornerpage_number - is the page you wish to extract frombreakFragments - will divide up text based on white space characterspunctuation - is a string containing all values that should be used to divide up wordsPdfException - If the co-ordinates are not validpublic final String extractTextInRectangle(int x1, int y1, int x2, int y2, int page_number, boolean estimateParagraphs, boolean breakFragments) throws PdfException
x1 - is the x coord of the top left cornery1 - is the y coord of the top left cornerx2 - is the x coord of the bottom right cornery2 - is the y coord of the bottom right cornerpage_number - is the page you wish to extract fromestimateParagraphs - will attempt to find paragraphs and add new lines in output if truebreakFragments - will divide up text based on white space characters if truePdfException - If the co-ordinates are not validpublic SortedMap findMultipleTermsInRectangleWithMatchingTeasers(int x1, int y1, int x2, int y2, int rotation, String[] terms, int searchType, SearchListener listener) throws PdfException
x1 - the left x cordy1 - the upper y cordx2 - the right x cordy2 - the lower y cordrotation - the rotation of the page to be searchedterms - the terms to search forsearchType - searchType the search type made up from one or more constants obtained from the SearchType classlistener - an implementation of SearchListener is required, this is to enable searching to be cancelledPdfException - If the co-ordinates are not validpublic SortedMap findTextWithinInAreaWithTeasers(int x1, int y1, int x2, int y2, int rotation, String[] terms, int searchType, SearchListener listener) throws PdfException
x1 - the left x cordy1 - the upper y cordx2 - the right x cordy2 - the lower y cordrotation - the rotation of the page to be searchedterms - the terms to search forsearchType - searchType the search type made up from one or more constants obtained from the SearchType classlistener - an implementation of SearchListener is required, this is to enable searching to be cancelledPdfException - If the co-ordinates are not validpublic List findMultipleTermsInRectangle(int x1, int y1, int x2, int y2, int rotation, String[] terms, boolean orderResults, int searchType, SearchListener listener) throws PdfException
x1 - the left x cordy1 - the upper y cordx2 - the right x cordy2 - the lower y cordrotation - the rotation of the page to be searchedterms - the terms to search fororderResults - if true the list that is returned is ordered to return the resulting rectangles in a
logical order descending down the page, if false, rectangles for multiple terms are grouped together.searchType - searchType the search type made up from one or more constants obtained from the SearchType classlistener - an implementation of SearchListener is required, this is to enable searching to be cancelledPdfException - If the co-ordinates are not validpublic final float[] findText(int x1,
int y1,
int x2,
int y2,
String[] terms,
int searchType)
throws PdfException
x1 - is the x coord of the top left cornery1 - is the y coord of the top left cornerx2 - is the x coord of the bottom right cornery2 - is the y coord of the bottom right cornerterms - : String[] of search terms, each String is treated as a single termsearchType - : int containing bit flags for the search (See class SearchType)PdfException - when the search encounters incorrect values in the page content that it can not recover frompublic final float[] findText(String[] terms, int searchType) throws PdfException
Method to find text in the specified area allowing for the text to be split across multiple lines.
terms - = the text to search forsearchType - = info on how to search the pdfPdfException - when the search encounters incorrect values in the page content that it can not recover frompublic String[] getTeasers()
public void generateTeasers()
Copyright © 2017. All rights reserved.