RE: PDFKit: problem with PDFView goToDestination across PDFViews.
RE: PDFKit: problem with PDFView goToDestination across PDFViews.
- Subject: RE: PDFKit: problem with PDFView goToDestination across PDFViews.
- From: Alexander Griekspoor <email@hidden>
- Date: Sat, 9 Dec 2006 10:58:37 +0000
Hi Michael,
Unfortunately, I don't have the solution and I want to echo your
question, having the same kind of troubles.
What might come in handy though are two methods I added to my custom
pdfview to deal with storing and restoring the current positions
within a page:
- (NSString *)stringFromCurrentDestination{
if(![self document])return nil;
PDFDestination *destination = [self currentDestination];
PDFPage *page = [destination page];
unsigned int pagenr = [[self document]indexForPage: page];
NSPoint p = [destination point];
NSArray *array = [NSArray arrayWithObjects: [NSString
stringWithFormat: @"%d", pagenr], NSStringFromPoint(p), nil];
return [array componentsJoinedByString: @";"];
}
- (void)goToDestinationFromString: (NSString *)string{
if(![self document]) return;
PDFDestination *dest = nil;
if(!string) {
[self goToTop];
return;
}
else {
NSArray *array = [string componentsSeparatedByString: @";"];
int pagenr = [[array objectAtIndex: 0]intValue];
PDFPage *page = [[self document] pageAtIndex: pagenr];
NSPoint p = NSPointFromString([array objectAtIndex: 1]);
dest = [[[PDFDestination alloc]initWithPage: page atPoint: p]
autorelease];
}
if(dest) [self goToDestination: dest];
}
It works much like NSStringFromRect and NSRectFromString..
However, me too would love to see someone solving this problem..
Cheers,
Alex
***********************************
Mek (Alexander Griekspoor)
MekenTosj.com
Web: http://www.mekentosj.com
Mail: email@hidden
***********************************
_______________________________________________
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