Many thanks for your reply - that worked perfectly! The only thing that didn't 
work between storing the bounds and retrieving them was something mentioned in 
the other thread: the returned rect had to be modified using NSIntegralRect() 
for it to be retrieved again via -selectionForRect:.

However, I didn't need to retrieve it that way in the end anyway - your 
suggestion of converting the line rects to highlight markup annotations was the 
perfect solution.

Thanks again!
All the best,
Keith


--- On Wed, 2/11/09, John Calhoun <calho...@apple.com> wrote:

> From: John Calhoun <calho...@apple.com>
> Subject: Re: Saving a PDF Selection or converting it to an NSRange and back

> To save a selection sapnning multiple pages you could
> convert a single selection into an array of single-line
> selections (-[PDFSelection selectionsByLine]).  Each
> selection returned by this method is going to be on a single
> page (and a single contiguous range and line).  The bounds
> then of these selections can be saved and then the
> selections recreated from those bounds.
> 
> I haven't tried the above but it should work in
> principle.
> 
> PDFSelection should probably expose some method of
> archiving in the future....

> No better, but different: you could take the bounds
> returned from the above discussion and instead create
> Highlight annotations.  These you can add to the PDF and
> save out.  Might save you some work since when re-opening
> the PDF you don't need to re-create the highlights since
> they're now embedded in the PDF.
> 
> John Calhoun—



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to