PDFview scrolls to bottom of the page in single page document
I propose this solution for scrolling to top of first page (it works on iOS 11.3):
if let document = pdfView.document,
let firstPage = document.page(at: 0)
{
let firstPageBounds = firstPage.bounds(for: pdfView.displayBox)
pdfView.go(to: CGRect(x: 0, y: firstPageBounds.height, width: 1.0, height: 1.0), on: firstPage)
}
This is what I did, it's a bit hacky
if let scrollView = pdfView.subviews.first as? UIScrollView {
scrollView.contentOffset.y = 0.0
}
I think this is a bug in PDFView.
As workaround I suggest to manually scroll top the top:
self.pdfView.document = pdfDocument;
NSPoint pt = NSMakePoint(0.0, [self.pdfView.documentView bounds].size.height);
[self.pdfView.documentView scrollPoint:pt];
Bug Reporter
rdar://37942090: PDFview scrolls to bottom of the page in single page document.