- (IBAction)generatePdfButtonPressed:(id)sender { pageSize = CGSizeMake(612, 792); NSString *fileName = @"Demo.pdf"; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName]; [self generatePdfWithFilePath:pdfFileName]; } - (void) generatePdfWithFilePath: (NSString *)thefilePath { UIGraphicsBeginPDFContextToFile(thefilePath, CGRectZero, nil); NSInteger currentPage = 0; BOOL done = NO; do {
source share