|
|
@@ -1,57 +0,0 @@
|
|
|
-//
|
|
|
-// PDFUtils.m
|
|
|
-// AntsContract
|
|
|
-//
|
|
|
-// Created by Ray on 12/20/16.
|
|
|
-// Copyright © 2016 United Software Applications, Inc. All rights reserved.
|
|
|
-//
|
|
|
-
|
|
|
-#import "PDFUtils.h"
|
|
|
-
|
|
|
-@implementation PDFUtils
|
|
|
-+(void) addSignature :(UIImage*) img to:(NSMutableDictionary*)signatureData
|
|
|
-{
|
|
|
-
|
|
|
-
|
|
|
- if(true)
|
|
|
- {
|
|
|
- NSString* newfile=[self saveTempSignature:UIImagePNGRepresentation(img)];
|
|
|
-
|
|
|
- int newidx = [signatureData[@"count"] intValue];
|
|
|
-
|
|
|
- // [@"file"]= newfile;
|
|
|
-
|
|
|
- NSMutableDictionary* item = [[NSMutableDictionary alloc] init];
|
|
|
- item[@"file"]=newfile;
|
|
|
- signatureData[[NSString stringWithFormat:@"item_%d",newidx]] = item;
|
|
|
- signatureData[@"count"]=[NSNumber numberWithInt:newidx+1];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-+(NSString *) saveTempSignature:(NSData *) image
|
|
|
-{
|
|
|
- NSString* tempDir = NSTemporaryDirectory();
|
|
|
-
|
|
|
- NSString *saveFileName=[NSString stringWithFormat:@"%@.png",[[NSUUID UUID ] UUIDString] ] ;
|
|
|
-
|
|
|
- NSString *newFilePath=[tempDir stringByAppendingPathComponent:saveFileName];
|
|
|
-
|
|
|
-
|
|
|
- bool bsuccess=[image writeToFile:newFilePath atomically:YES];
|
|
|
- if(bsuccess)
|
|
|
- {
|
|
|
-
|
|
|
- return newFilePath;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return nil;
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-@end
|