0

I'm showing a pdf file inside a UIDocumentInteractionController, like this:

let docController = UIDocumentInteractionController(url: documentsURL)
    let url = NSURL(string:"itms-books:");
    if UIApplication.shared.canOpenURL(url! as URL) {
        docController.delegate = self
        docController.presentPreview(animated: true)
    }

I need to automatically scroll to the last page when the controller is shown, is there a way to do that? I didn't find one. Thanks to anyone who will send help!

1 Answer 1

1

I am afraid there is not a straight forward solution for this, even the documentation says it's a UIViewController but Xcode shows it is inherited from NSObject. I'd recommend either rendering the PDF on a WKWebView or a UIScrollView. This will give you a room to wiggle.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you so much, you confirmed my sad hypothesis! :( The point is: I need to show the pdf in a modal view, I previously used a WebView and worked perfectly but I need the user to be able to at least save the file..any hint for this? Thanks again
Maybe a custom button with a share option and you can use UIActivityViewController to do the trick for you.
yeah I was thinking about a custom navigation bar similar to that one of the UIDocumentInteractionController. Last trial with UIDocumentInteractionController: have you figured out what annotations are for?
I believe they are used for the options menu so other apps can extract a meta data like information to better handle it if they were used as a share option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.