![]() ![]()
I’m also not certain that I’m using PDFThumbnailView as intended here, so maybe this isn’t even supposed to work and I’ve just stumbled across something that makes it do what I want. It’s a risk and I’ll have to test on beta iOS releases. Sicne this isn’t documented, it could change in the next version of iOS and break my layout. ![]() Of course this is all based on my observations of how PDFThumbnailView currently works. I speculate that there’s a bit of padding before the first thumbnail and after the last one, but I can’t be sure. Doing it that way still has layout issues though– it has to be at least pdfDocument.pageCount times. If it’s necessary because of space between thumbnails, it seems like the padding should appear pdfDocument.pageCount - 1 times. One detail I don’t completely understand is that I needed to add the extra padding once per page. All thumbnails are visible in a scrolling view, and the current page’s thumbnail is exactly where it should be. A little extra width was all the layout needed. The width is now the number of pages multiplied by the thumbnail width plus a fudge factor for every page. ![]() (equalToConstant: CGFloat(pdfDocument.pageCount *(thumbnailSize + pdfThumbnailPerPagePadding))) I’ll add a variable to hold the extra padding, and then modify the thumbnail view’s width constraint to use it. But I still couldn’t be sure that this was what caused the off-center thumbnails. My thumbnail view was not quite wide enough to hold all the thumbnails. The horizontal distance from one thumbnail to the next was 2 pixels more than the thumbnail width. I took a couple of screenshots and examined them with xScope and found that this was the case. So maybe there’s some padding between thumbnails I should account for? I can choose what size thumbnail I want, but I can’t tell the thumbnail view anything else about its layout. I guessed that this might be due to spacing between thumbnail images. Thats why Ive written the little helper script - if, for example, Ive started up with the Mavericks version of PDFKit, and see that while Skim works, Preview is not starting, then I just switch over to the Sierra version - without rebooting or anything - and then Preview works. It also breaks, from time to time, Preview. I experimented with a few random-seeming changes hoping for a fix (a bit of shotgun debugging) and eventually found that if I made the thumbnail view wider, the problem disappeared. This fixes the annotation issues with Skim for me. And not buggy because of any documented requirements I’m not meeting. You end up with the same page number appearing twice with different sizes. APPLE FIXES PREVIEW BUT PROBLEMS WITH PDFKIT FULLNear the end of the document it’s off by nearly a full thumbnail. Near the beginning of the document it’s exactly right.īut as you go through the document, the larger thumbnail for the current page gets skewed off center. It looks good at first, but as you go through the document, something weird happens. (equalTo: pdfThumbnailScrollView.bottomAnchor)Īdd the scroll view to the view hierarchy, and that’s it! (equalTo: pdfThumbnailScrollView.topAnchor), If let documentURL = .constraint(equalTo: pdfThumbnailScrollView.leadingAnchor), You could do this: pdfView = PDFView(frame: ame) You can try using the PDFView without PageViewController and see you it behaves. APPLE FIXES PREVIEW BUT PROBLEMS WITH PDFKIT CODEIf so, it's not your code which is at fault, but the resources needed to display and render it to the view. APPLE FIXES PREVIEW BUT PROBLEMS WITH PDFKIT PDFDo you have more information on your PDF?Ĭould you try with a PDF with less heavy images? It should render fine. I think this is due to the high resolution of your PDF and the way PDFView renders PDF. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |