PDFKit: problem with PDFView goToDestination across PDFViews.
PDFKit: problem with PDFView goToDestination across PDFViews.
- Subject: PDFKit: problem with PDFView goToDestination across PDFViews.
- From: "Michael McCracken" <email@hidden>
- Date: Fri, 8 Dec 2006 17:48:49 -0800
Hi, list:
Is it possible to use a PDFDestination generated from one PDFView to
direct another PDFView to go there (assuming they display the same PDFDocument)?
I believe I've read all the PDFKit docs, and it seems like I should be
able to do this.
I want to click on a PDFView and have a new window with a second
PDFView open that shows that point.
I actually wanted to do that with destinations of link annotations,
but even the easy case doesn't quite work:
in a subclass of PDFView, in -mouseDown:(NSEvent *)theEvent, I'm doing this:
NSPoint windowMouseLoc = [theEvent locationInWindow];
NSPoint viewMouseLoc = [self convertPoint:windowMouseLoc
fromView:nil];
PDFPage *page = [self pageForPoint:viewMouseLoc
nearest:YES];
NSPoint pageSpaceMouseLoc = [self convertPoint:viewMouseLoc
toPage:page];
PDFDestination *dest = [[[PDFDestination alloc] initWithPage:page
atPoint:pageSpaceMouseLoc] autorelease];
[controller showSubWindowAtDestination:dest];
// => this leads to calling "[pdfView goToDestination:dest];" on a
new PDFView in a different window. (It has the same PDFDocument).
// note that replacing this call with [self goToDestination:dest];
works as expected, in the original PDFView of course.
All of the values look sane in the debugger, including the value of dest,
up until the call to goToDestination, which scrolls to the right page
but invariably
just goes to the top of the correct page, apparently ignoring the
value of dest.point.
It doesn't completely ignore it, though - if I set it to something
arbitrary, like NSMakePoint(20,20), it will scroll to the top of the
page following dest.page.
I don't understand how it is using the point value of the destination
argument. Can anyone shed some light on this for me?
This looks like it ought to be the easiest way to do what I want, but
is there any other way that will work? Should I be using selections or
text searching?
Thanks,
-mike
--
Michael McCracken
misc: http://michael-mccracken.net/wp/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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