Skip navigation.
 
mlRe: indexForPage: page not found - Problem with PDFView on Tiger, works fine on Leopard
FROM : John Calhoun
DATE : Tue Feb 26 21:25:43 2008

On Feb 17, 2008, at 1:07 PM, Kevin Ross wrote:
> 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


It's hard to answer you without knowing more about your class/app.

I take it the code snippet is from KRImposerDocument?  This is a 
PDFView subclass?

What does skipToPage: do?  Specifically, is it 1-based or zero based 
(because PDFKit is zero-based).


> 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.


That bit puzzles me.  How are you creating the document 
programatically?  There were small odd differences between Leopard and 
Tiger here....

John Calhoun—

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