Skip navigation.
 
mlindexForPage: page not found - Problem with PDFView on Tiger, works fine on Leopard
FROM : Kevin Ross
DATE : Sun Feb 17 22:07:35 2008

Hi, I have recently stumbled upon a strange problem which I am at a 
loss to solve.  Any pointers would be greatly appreciated.

This snippet of code works fine on Leopard but not on Tiger.....

- (void)awakeFromNib  {

   NSString *outPath = [@"~/Desktop/debug.pdf" 
stringByExpandingTildeInPath];
   [self writeDebugPDFDocument:[self pdfDocument] toPath:outPath];
   

   [self setPageCount:[pdfDocument pageCount]];    <---- pageCount = 1 
(like it should)
   [pdfView setDocument:[self pdfDocument]];    <-------  Throws 
exception here.
   [self skipToPage:[NSNumber numberWithInt:1]];
   [pdfView layoutDocumentView];
}

Debugger log output:    
2008-02-17 12:26:51.163 Imposer[455] indexForPage: page not found
2008-02-17 12:26:51.163 Imposer[455] *** Uncaught exception: 
<NSGenericException> indexForPage: page not found

Stack trace:
#0    0x92c0107c in _NSRaiseError
#1    0x92c00db8 in +[NSException raise:format:]
#2    0x9648b894 in -[PDFDocument indexForPage:]
#3    0x9648aaec in -[PDFView viewSizeForPage:]
#4    0x9648a1b0 in -[PDFView resizeDisplayView:]
#5    0x964899e0 in -[PDFView setDocument:]
#6    0x000d512c in -[KRImposerDocument awakeFromNib] at 
KRImposerDocument.m:78

I added the first two lines of code to ensure that the document is 
valid and that the page does in fact exist.  When I check the document 
that is written to the desktop, it does in fact have the page and 
appears to be normal.  I'm wondering why the PDFView is unable to 
access the page when the document does in fact have the page.

I'm sure it's something I'm doing (possibly some autorelease 
craziness?) since this snippet works fine when the document is opened 
via the "Open" menu, and only happens when a new document has been 
created programmatically from the originally opened one.

Let me know if I need to provide more information.  Again, any 
pointers would be greatly appreciated.  Thanks for the help.

Kevin

Related mailsAuthorDate
mlindexForPage: page not found - Problem with PDFView on Tiger, works fine on Leopard Kevin Ross Feb 17, 22:07
mlRe: indexForPage: page not found - Problem with PDFView on Tiger, works fine on Leopard John Calhoun Feb 26, 21:25