Creating Documents from Form Data

Discussion in 'iOS Programming' started by tjmoore, Oct 22, 2013.

  1. tjmoore macrumors newbie

    May 17, 2011
    Hey All,

    I'm relatively new to the coding scene and I have a client that would like a basic app where he can punch in a few variables, select some drop down options and have that data be injected into a pre-formatted document and exported as a PDF file onto his iPad (so that HIS client can sign the PDF on-site and have it emailed to them). What's the best way to go about doing this?

    Very broad question, I know. If this isn't the best forum for it, feel free to bump this posting where it ought to go.

    Thanks for your help!

  2. amorya macrumors 6502

    Jun 17, 2007
    Start your PDF context by doing something like this:

    NSMutableData *pdfData = [NSMutableData data];
        CGRect a4 = CGRectMake(0.0, 0.0, 595.0, 842.0);
        UIGraphicsBeginPDFContextToData(pdfData, a4, nil);
    Then, to begin each page, you can call

    At this point, draw whatever you want to add to your PDF. Do your drawing exactly the same way you would draw to a view on screen (e.g. using the Core Graphics functions or UIKit drawing methods).

    To get the coordinates of the page, so you know where to draw, call

    Once you've finished drawing, call

    Now your pdfData variable contains your PDF's data. You can then save it as a file or email it, as you see fit.

Share This Page