Load PDF into UIImage or UIImageView?
-
23-09-2019 - |
Question
This is my first ever question on stackoverflow.
I'm trying to load a PDF file stored in Resources into a UIImage/UIImageView object in the iPhone SDK. Is this at all possible without converting the PDF to an image? If not, what are the member functions for converting a PDF into a PNG? I would really prefer to preserve the PDF if at all pssoible.
Thanks so much for the help!
Solution
PDFs can be loaded by UIWebView. If you need more control you can use Quartz 2D to render PDFs: Quartz2D
OTHER TIPS
Now it is possible, I am using iOS 8+.
If you put a pdf in your assets catalog, and then load the pdf in a UIImage using [UIImage imageNamed:]
it renders the first page of the pdf into the UIImage.
You may want to check out this UIImage-PDF category over on GitHub: https://github.com/mindbrix/UIImage-PDF