iosobjective-ccgpdf

Simple Pdf Viewer using CGPDF


I need to create a pdf viewer application in iOS .I found using Quartz CGPDF can achieve this I can't found a proper start . I checked apple documentation .https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html . Can anyone suggest any sample code or tutorial regarding this . I don't want to display pdf in a web view or don't want to use any third party framework .

Thanks in Advance .


Solution

  • This worked well for me. Given, it was on the Apple TV, but it does not use WebKit, and I'm sure it works just as well on iOS. It draws a PDF using CGPDF from either a local source or from a URL.

    Rendering PDF in Apple TV tvOS

    Also want to point out that where it says UIGraphicsBeginImageContext(pageRect.size), I replaced this with UIGraphicsBeginImageContextWithOptions(pageRect.size, NO, 5.0); because I found that the CGPDF image created is very fuzzy and blurry. By beginning the contxt with options, you can change the scale factor (5.0) and this increases the number of pictures, increasing the resolution.