Hi, if I create a very simple app that just loads a 2 page PDF with PDFKit, where the size of the view is the entire screen, I'm not able to scroll the PDF up and down. This is an issue because I have a title bar and navigation buttons at the bottom and I need to scroll the PDF up so I can see the bottom of the PDF page.
Details:
PDF scrolling bug. I created PDFView on whole screen and set pdfview’s content inset as (100,0,100,0). So when app is launched, PDFView should be scrollable to show top and bottom area of PDF because I set content inset. But it isn’t scrollable at this scale. If you zoom in a little, then PDFView become scrollable.
Here's the exact code I added to the ViewController on a new project.
Is this a bug in PDFKit or is there a way to add padding on the top and bottom?
Details:
PDF scrolling bug. I created PDFView on whole screen and set pdfview’s content inset as (100,0,100,0). So when app is launched, PDFView should be scrollable to show top and bottom area of PDF because I set content inset. But it isn’t scrollable at this scale. If you zoom in a little, then PDFView become scrollable.
Here's the exact code I added to the ViewController on a new project.
Is this a bug in PDFKit or is there a way to add padding on the top and bottom?
Code Block let pdfdoc = PDFDocument(url: Bundle.main.url(forResource: "1", withExtension: "pdf")!) pdfview.pageBreakMargins = .zero pdfview.pageShadowsEnabled = false pdfview.document = pdfdoc pdfview.autoScales = false pdfview.scaleFactor = (UIScreen.main.bounds.height - 100) / (792 * 2) (pdfview.subviews[0] as? UIScrollView)?.contentInsetAdjustmentBehavior = .never (pdfview.subviews[0] as? UIScrollView)?.contentInset.top = 100 (pdfview.subviews[0] as? UIScrollView)?.contentInset.bottom = 100 (pdfview.subviews[0] as? UIScrollView)?.verticalScrollIndicatorInsets.top = 100 (pdfview.subviews[0] as? UIScrollView)?.verticalScrollIndicatorInsets.bottom = 100 }