Re: Creating a PDFSelection...
Re: Creating a PDFSelection...
- Subject: Re: Creating a PDFSelection...
- From: John Calhoun <email@hidden>
- Date: Wed, 26 May 2010 11:50:16 -0700
On May 25, 2010, at 9:37 PM, Matthew Weinstein wrote:
> Actually, I don't need the tiff; I just need the rectangle! People have to be able to sketch the rectangle over the pdf, and then my program stores and restores those rectangles (with some additional information).
PDFSelection has a routine to return each line from the selection as a sub-selection (for a single word selection this generally is just the selection itself, but for selections that span multiple lines you get a new selection for each line).
For each "line selection" you can get its bounds. These you can store/archive along with the page index.
With the archived rectangles and page indices you can later create selections again from those rectangles (PDFPage has -[selectionForRect:]).
This isn't a perfect solution though — you may have to pad out the rectangle a bit for example to improve fidelity between the original selection and the unarchived one.
If you know the range of the original text selected, PDFPage's -[selectionForRange:] is unambiguously specified.
John Calhoun—_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden