Changing PDF pages
Changing PDF pages
- Subject: Changing PDF pages
- From: Ben Mackin <email@hidden>
- Date: Wed, 07 Aug 2002 16:49:58 -0700
Ok, I have a 5 page pdf (lets say) and I want the displaying page (in my
NSImageView) to change when I push the next page button. The following code
works to get me the number of pages in the document:
myPDFasData = [[NSData alloc] initWithContentsOfFile:@"/tmp/myFile.PDF"];
myPDF = [[NSPDFImageRep alloc] initWith
Data:myPDFasData];
numPages = [myPDF pageCount];
However, now I am at a loss of how to change the page. I saw the
setCurrentPage function, but am not sure exactly how to implement it. Here
is what I have tried:
[image1 addRepresentation:myPDF];
[myPDF setCurrentPage:curPage];
myPDFasData = [myPDF PDFRepresentation];
image1 = [[NSImage alloc] initWith
Data:myPDFasData];
myImageToDisplay = [[NSImage alloc] initWithSize:kUSLetterSize];
[myImageToDisplay lockFocus];
[image1 compositeToPoint:NSZeroPoint operation:NSCompositeCopy];
[myImageToDisplay unlockFocus];
But no matter the curPage variable is set to, it always only shows the first
page. If anyone has some insight, please let me know.
Thanks,
Ben
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.