Some test text!

menu

Text search

There are two parts to text searching. First is the UI component that is presented to the user. Second is an API guide to perform the text search functionality.

Text search API for iOS

To search for text in a PDF using regular expression.

PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
PTTextSearch *txt_search = [[PTTextSearch alloc] init];
unsigned int mode = e_ptwhole_word | e_ptpage_stop;
NSString *pattern = @"";

//use regular expression to find credit card number
mode |= e_ptreg_expression | e_pthighlight;
[txt_search SetMode: mode];
pattern = @"\\d{4}-\\d{4}-\\d{4}-\\d{4}"; //or "(\\d{4}-){3}\\d{4}"
[txt_search SetPattern: pattern];

//call Begin() method to initialize the text search.
[txt_search Begin: doc pattern: pattern mode: mode start_page: -1 end_page: -1];
PTSearchResult *result = [txt_search Run];

Search PDF files for text
Full code sample which shows how to use TextSearch to search text on PDF pages using regular expressions.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our upcoming webinar to find out about built-in, full-functioning document capabilities directly in Salesforce.

Save your seat
close