looking for a PDF renderer library

Discussion in 'iOS Programming' started by grandM, Feb 25, 2016.

  1. grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #1
    Hi

    I'm looking for a library. This library would make it easy to generate PDF from data in my CoreData setup. I would prefer it being in swift. I have been fumbling around with a tutorial of raywenderlich. This allowed me to create PDF's on a rudimentary level using Core Text. It works and I'll gladly share it with you. Problem is it lacks a lot of functionality I'm looking for. For instance it seems I would have to calculate when to create a new page. I also doesn't break up text. I have been googling but did not find anything useful. Certainly nothing that I understood.

    So I wondered if any of you knew a good library easy to implement?

    Thanks!
     
  2. tyche macrumors 6502

    Joined:
    Jul 30, 2010
    #2
    Two I know of are PDFGenerator and SimplePDF. Both are in Swift. You can find them on Cocoapods of github.
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    @grandM, SimplePDF looks like it will paginate text for you. Even if you don't use that class you should look at the code it uses to draw attributed strings, which paginates the string using Core Text.
     
  4. grandM thread starter macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #4
    Thanks I winded up writing my own class. The only thing I'm still wondering about is if I have to manually release memory? I'm using Core Text. But in the tutorial there were things like
    Code:
    CFRelease(frameRef)
    CFRelease(stringRef)
    CFRelease(framesetter)
    CGPathRelease(framePath)
    
    Or are these no longer needed with ARC?
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    If you're writing this code in swift then you don't need the CFRelease() calls. This is not because of ARC but rather that the swift versions of these method calls return swift objects, that are automatically memory managed.

    If you're writing in Objective-C it's probably different.
     

Share This Page