Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tjmoore

macrumors newbie
Original poster
May 17, 2011
9
0
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!

Thomas
 
Start your PDF context by doing something like this:

Code:
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

Code:
UIGraphicsBeginPDFPage();

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

Code:
UIGraphicsGetPDFContextBounds()

Once you've finished drawing, call

Code:
UIGraphicsEndPDFContext();

Now your pdfData variable contains your PDF's data. You can then save it as a file or email it, as you see fit.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.