0

I'm trying to use UIScrollView together with UIImageView to display a PDF with several pages. Problem is that only seems to render the first page of the PDF and nothing else.

Is this possible at all with UIScrollView + UIImageview?

3
  • 1
    you can use the UIWebView for render the PDF file. Commented Mar 13, 2017 at 13:50
  • With multiple pages? Any specific options you need to enable for it display them all? Commented Mar 13, 2017 at 14:14
  • just create the UIWebView and load the URL of your pdf file. Commented Mar 13, 2017 at 14:17

1 Answer 1

1

Perhaps you can create as UIImageView in the UIScrollView as pages has the PDF, and then when you load the PDF page (you wold use something like CGPDFDocumentGetPage(document, pageNumber)), just set the pageNumber to the number you want. You can know how many pages does the PDF document have with CGPDFDocumentGetNumberOfPages.

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

2 Comments

I'll look into it! I evaluating which option to use right now. Webview works fine but it feels clunky to "open up a new view". I tried PSPDFKit which has a'lot of cool functionality but it's pricey and heavy. My prefered option would be to use just UIScrollView and UIImageView to display PDF's but if it's to much hassle to display multiple pages I might reconsider. I thought it would be more straight forward this tho.
You can use UIScrollView with UIImageView, just init each UIImageView with each page, using the method I'm telling you :)

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.