I\'m using quartz to display pdf. I need to get the indexes of pages where my searching text exists. Anyone can help me? Thanks.
Solution: There is a sa
If you use PDFDocument
, instead of CGPDFDocument
, that API has text search operations, such as findString:withOptions
There's nothing to do this inside of Quartz. Quartz is for graphics display - it doesn't need to know, or care about, searching a PDF for string matches. You will have to use the Core Graphics PDF parsing methods to pull out the data, search for the string yourself, and then get the page it occurs on.
Use CGPDFDocument, CGPDFPage and CGPDFScanner to scan and parse the contents of the page into NSString. Then use NSString function to find the text on that page. If it exists store the corresponding pagenumber in some array. Repeat this scanning and parsing in for loop for number of pages in the pdf
http://www.random-ideas.net/posts/42%22
check out the above link its working.