PDFThumbnailView broken on macOS 10.12

Hi,


Does anybody know a workaround for the bug that PDFThumbnailView is no longer working (thumbnails cannot be selected anymore) on macOS Sierra?


rdar://28754282

Replies

Same here. Couldn't find any way to make it respond to selecting and dragging again. Will probably just ditch it altogether and roll out my own based on a collection view.

Did you find a solution for the selection problem or can you share your collection view? Thank you!

I didn't get around to writing my own PDFThumbnailView replacement yet. I want to check wheter 10.12.2 update solves any of the PDFKit problems before I decide how to approach this and the many other PDFKit issues.

PDFThumbnailView continues to be broken in macOS 10.12.3 beta 1.


Also filed a bug report: #29739427.


😟

I cannot wait for a fix in 10.3. I need also a fallback for 10.12.1 an 10.12.2. I wrote my own PDFThumbnailView implementation which should work as expected.

Search on Github for HSPDFThumbnailView.


I hope it will also work for your projects.

Thanks for your code :-) I've just added a check on selectionIndex to prevent a potential crash


- (void)observeValueForKeyPath:(NSString *)keyPath

ofObject:(id)object

change:(NSDictionary *)change

context:(void *)context

{

if ([keyPath isEqualToString:@"selectedObjects"])

{

if ( self.arrayController.selectionIndex != NSNotFound )

[self.PDFView goToPage:[self.PDFView.document pageAtIndex:self.arrayController.selectionIndex]];

}

else if ([keyPath isEqualToString:@"document"])

{

[self willChangeValueForKey:@"items"];

[self.items removeAllObjects];

for (int i=0; i < self.PDFView.document.pageCount; i++)

{

NSMutableDictionary *newDict = [NSMutableDictionary new];

[newDict setObject:[NSString stringWithFormat:@"%d", (i + 1)] forKey:@"label"];

[newDict setObject:[self.PDFView.document pageAtIndex:i] forKey:@"page"];

[self.items addObject:newDict];

}

[self didChangeValueForKey:@"items"];

}

}