PDFViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. //
  2. // PDFViewController.m
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 14-8-7.
  6. // Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "PDFViewController.h"
  9. #import "RAUtils.h"
  10. #import "const.h"
  11. #import "AppDelegate.h"
  12. @interface PDFViewController ()
  13. @end
  14. @implementation PDFViewController
  15. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  16. {
  17. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  18. if (self) {
  19. // Custom initialization
  20. }
  21. return self;
  22. }
  23. - (void)viewDidLoad
  24. {
  25. [super viewDidLoad];
  26. // Do any additional setup after loading the view.
  27. UIRefreshControl *ref = [[UIRefreshControl alloc]init];
  28. ref.tag = 200 ;
  29. ref.attributedTitle = [[NSAttributedString alloc]initWithString:@"drag to refresh"];
  30. ref.tintColor = [UIColor colorWithRed:0.10 green:0.68 blue:0.94 alpha:0.7];
  31. // ref.hidden = true;
  32. [ref addTarget:self action:@selector(changeCell) forControlEvents:UIControlEventValueChanged];
  33. [self.webView.scrollView addSubview:ref];
  34. self.webView.dataDetectorTypes=UIDataDetectorTypeAll;
  35. UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
  36. style:UIBarButtonItemStylePlain
  37. target:self
  38. action:@selector( onBackClick:)];
  39. //[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Close", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onCloseClick:)];
  40. // closeButton.title = @"Close";
  41. self.navigationItem.leftBarButtonItem = closeButton;
  42. self.btnshare = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"share"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  43. style:UIBarButtonItemStylePlain
  44. target:self
  45. action:@selector(onActionClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Edit", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onOpenOrderClick:)];
  46. self.btnshare.tintColor = UIColorFromRGB(0x996633);
  47. self.btnemail =[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"mail"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  48. style:UIBarButtonItemStylePlain
  49. target:self
  50. action:@selector(onEmailClick:)];// [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Commit", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onCommitOrderClick:)];
  51. self.btnemail.tintColor = UIColorFromRGB(0x996633);
  52. // self.btnSend = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Email", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onSendMailClick:)];
  53. self.btnsave = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"save"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  54. style:UIBarButtonItemStylePlain
  55. target:self
  56. action:@selector(onSaveClick:)];
  57. self.btnsave.tintColor = UIColorFromRGB(0x996633);
  58. UIBarButtonItem *fixedItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
  59. fixedItem.width = 20.0f;
  60. NSMutableArray * items = [[NSMutableArray alloc]init];
  61. [items addObject:self.btnshare];
  62. [items addObject:fixedItem];
  63. [items addObject:self.btnemail];
  64. if(self.canSave)
  65. {
  66. [items addObject:fixedItem];
  67. [items addObject:self.btnsave];
  68. }
  69. self.navigationItem.rightBarButtonItems=items;
  70. self.btnshare.enabled =false;
  71. self.btnemail.enabled =false;
  72. self.btnsave.enabled =false;
  73. // self.url=@"http://192.168.1.3:8080/npd/test.pdf";
  74. // NSURL* url = [NSURL URLWithString:self.url];
  75. //
  76. // NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:self.url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:2000];
  77. //
  78. //
  79. // [self.webView loadRequest:request];
  80. [self loadcontent];
  81. }
  82. - (void)onBackClick:(UIButton *)sender {
  83. [self.navigationController popViewControllerAnimated:FALSE];
  84. }
  85. -(void)ReloadData
  86. {
  87. // Count ++ ;
  88. // [mytabelview reloadData];
  89. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
  90. [reF endRefreshing];
  91. [self loadcontent];
  92. }
  93. -(void) loadcontent
  94. {
  95. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Loading..."];
  96. self.mum.hidden=false;
  97. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  98. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:self.url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60*5];
  99. //设置请求方式为get
  100. [request setHTTPMethod:@"GET"];
  101. //添加用户会话id
  102. [request addValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
  103. //连接发送请求
  104. NSHTTPURLResponse* urlResponse = nil;
  105. NSError *error = [[NSError alloc] init];
  106. self.content= [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
  107. self.filename = [urlResponse suggestedFilename];
  108. dispatch_async(dispatch_get_main_queue(), ^{
  109. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  110. self.navigationItem.title = self.save_name;
  111. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
  112. // self.content=nil;
  113. if(self.content!=nil&&self.content.length>0)
  114. {
  115. [reF removeFromSuperview];
  116. // NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  117. NSString *path = NSTemporaryDirectory();
  118. NSString *filePath = [path stringByAppendingPathComponent:self.filename];
  119. // NSError *error = [[NSError alloc] init];
  120. // BOOL bo = [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
  121. // NSAssert(bo,@"创建目录失败");
  122. [self.content writeToFile:filePath atomically:YES];
  123. self.btnshare.enabled =true;
  124. self.btnemail.enabled =true;
  125. self.btnsave.enabled =true;
  126. if(self.onLoadSuccess)
  127. self.onLoadSuccess(self.url);
  128. if(self.autoPrint)
  129. [self startAirPrintWithData:self.content];
  130. // int a=0;
  131. }
  132. else
  133. {
  134. [RAUtils message_alert:nil title:@"Open PDF Failed" controller:self];
  135. if(self.autoPrint)
  136. [self.navigationController popViewControllerAnimated:true];
  137. // self.content = [self.url dataUsingEncoding:NSUTF8StringEncoding];
  138. }
  139. ;
  140. // NSLog(@"%@",[[NSString alloc] initWithData:self.content encoding:NSASCIIStringEncoding]);
  141. //
  142. [self.webView loadData:self.content MIMEType:urlResponse.MIMEType textEncodingName:nil baseURL:nil];
  143. });
  144. });
  145. }
  146. -(void)changeCell
  147. {
  148. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
  149. reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"refreshing"];
  150. if ([self respondsToSelector:@selector(ReloadData)])
  151. [self performSelector:@selector(ReloadData) withObject:nil afterDelay:1];
  152. // DebugLog(@"refresh!!!!!!!!");
  153. }
  154. - (void)didReceiveMemoryWarning
  155. {
  156. [super didReceiveMemoryWarning];
  157. // Dispose of any resources that can be recreated.
  158. }
  159. -(void) viewWillAppear:(BOOL)animated
  160. {
  161. [super viewWillAppear:animated];
  162. [[self navigationController] setNavigationBarHidden:self.hidenavi animated:NO];
  163. }
  164. - (IBAction)onActionClick:(id)sender {
  165. //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  166. NSString *path = NSTemporaryDirectory();
  167. NSString* filename =self.filename;
  168. NSString *filePath = [path stringByAppendingPathComponent:filename];
  169. [self openFile:filePath];
  170. }
  171. - (IBAction)onSaveClick:(id)sender {
  172. //UIAlertControllerStyle两种类型UIAlertControllerStyleAlert类似UIAlertView
  173. //UIAlertControllerStyleActionSheet类似UIActionSheet
  174. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Save pdf" message:nil preferredStyle:UIAlertControllerStyleAlert];
  175. //block代码块取代了delegate
  176. [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
  177. textField.text = self.save_name;
  178. }];
  179. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Save" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  180. UITextField *name = alertControl.textFields.firstObject;
  181. if(name.text.length==0)
  182. {
  183. [RAUtils message_alert:@"Cannot save without name. Save canceled." title:@"Name is missing" controller:self];
  184. }
  185. else
  186. {
  187. self.save_name = name.text;
  188. self.btnsave.enabled =false;
  189. // NSMutableDictionary * info =
  190. if(self.onSavePDF)
  191. self.onSavePDF(self.save_name,self.filename);
  192. }
  193. }];
  194. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  195. NSLog(@"Cancel");
  196. }];
  197. [alertControl addAction:actionOne];
  198. [alertControl addAction:alertthree];
  199. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  200. [self presentViewController:alertControl animated:YES completion:nil];
  201. }
  202. - (IBAction)onEmailClick:(id)sender {
  203. //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  204. NSString *path = NSTemporaryDirectory();
  205. NSString* filename =self.filename;
  206. NSString *filePath = [path stringByAppendingPathComponent:filename];
  207. MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
  208. mc.mailComposeDelegate = self;
  209. [mc setSubject:self.mail_subject];
  210. [mc setToRecipients:self.mail_to];
  211. if(self.mail_content==nil)
  212. self.mail_content=@"";
  213. NSString* htmlbody = [NSString stringWithFormat:@"<html><p>%@</p></html>",self.mail_content];
  214. [mc setMessageBody:htmlbody
  215. isHTML:YES];
  216. NSData *data = [NSData dataWithContentsOfFile:filePath];
  217. if(self.attachment_name.length>0)
  218. filename = self.attachment_name;
  219. [mc addAttachmentData:data mimeType:@"application/pdf" fileName:filename];
  220. [self presentModalViewController:mc animated:YES];
  221. return;
  222. }
  223. -(void)openFile: (NSString *) file_url {
  224. NSURL *file_URL = [NSURL fileURLWithPath:file_url];
  225. if (file_URL != nil) {
  226. if (self.fileInteractionController == nil) {
  227. //_fileInteractionController = [[UIDocumentInteractionController alloc] init];
  228. _fileInteractionController = [UIDocumentInteractionController interactionControllerWithURL:file_URL];
  229. _fileInteractionController.delegate = self;
  230. // [_fileInteractionController retain];//不适用ARC,记得RETAIN 使用ARC注释这一行
  231. }
  232. else
  233. {
  234. self.fileInteractionController.URL = file_URL;
  235. }
  236. // [self.fileInteractionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
  237. [self.fileInteractionController setName:self.mail_subject];
  238. // [self.fileInteractionController setAnnotation:<#(id _Nullable)#>;
  239. [self.fileInteractionController presentOptionsMenuFromBarButtonItem:self.btnshare animated:YES];
  240. // [self.fileInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
  241. // [self.fileInteractionController presentPreviewAnimated:YES];
  242. }
  243. }
  244. - (void) sendEmail:(NSString *)to cc:(NSString*)cc subject:(NSString*)subject body:(NSString*)body
  245. {
  246. NSString* str = [NSString stringWithFormat:@"mailto:%@?cc=%@&subject=%@&body=%@",
  247. to, cc, subject, body];
  248. str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  249. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
  250. }
  251. #pragma mark methods for the UIDocumentInteractionControllerDelegate
  252. - (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller
  253. {
  254. // if (controller == self.fileInteractionController) {
  255. // self.fileInteractionController = nil;
  256. // }
  257. }
  258. - (void)previewDocumentWithURL:(NSURL*)url
  259. {
  260. UIDocumentInteractionController* preview = [UIDocumentInteractionController interactionControllerWithURL:url];
  261. preview.delegate = self;
  262. [preview presentPreviewAnimated:YES];
  263. }
  264. - (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
  265. {
  266. }
  267. - (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller{
  268. return self;
  269. }
  270. - (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller{
  271. return self.view.frame;
  272. }
  273. - (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller{
  274. return self.view;
  275. }
  276. - (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(nullable NSString *)application // bundle ID
  277. {
  278. }
  279. #pragma mark - web view delegate
  280. - (void)webViewDidFinishLoad:(UIWebView *)webView
  281. {
  282. self.mum.hidden=true;
  283. }
  284. #pragma mark -MFMailComposeViewControllerDelegate delegate
  285. - (void)mailComposeController:(MFMailComposeViewController*)controller
  286. didFinishWithResult:(MFMailComposeResult)result
  287. error:(NSError*)error {
  288. switch (result)
  289. {
  290. case MFMailComposeResultCancelled:
  291. NSLog(@"Mail send canceled...");
  292. break;
  293. case MFMailComposeResultSaved:
  294. NSLog(@"Mail saved...");
  295. break;
  296. case MFMailComposeResultSent:
  297. NSLog(@"Mail sent...");
  298. break;
  299. case MFMailComposeResultFailed:
  300. NSLog(@"Mail send errored: %@...", [error localizedDescription]);
  301. break;
  302. default:
  303. break;
  304. }
  305. [self dismissModalViewControllerAnimated:YES];
  306. }
  307. /*
  308. #pragma mark - Navigation
  309. In a storyboard-based application, you will often want to do a little preparation before navigation
  310. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  311. {
  312. Get the new view controller using [segue destinationViewController].
  313. Pass the selected object to the new view controller.
  314. }
  315. */
  316. - (void)startAirPrintWithData:(id )data
  317. {
  318. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"preparing print..."];
  319. UIPrintInteractionController* airPrinterController=[UIPrintInteractionController sharedPrintController];
  320. UIPrintInfo *printInfo = [UIPrintInfo printInfo];
  321. printInfo.outputType = UIPrintInfoOutputGeneral;
  322. printInfo.orientation = UIPrintInfoOrientationPortrait;
  323. printInfo.jobName = @"CoolVisitAirPrint";
  324. airPrinterController.printInfo = printInfo;
  325. airPrinterController.printingItem = data;
  326. airPrinterController.delegate = self;
  327. airPrinterController.showsNumberOfCopies=true;
  328. airPrinterController.showsPageRange = true;
  329. airPrinterController.showsPaperSelectionForLoadedPapers=true;
  330. void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
  331. if(completed && error)
  332. NSLog(@"Printing failed due to error in domain %@ with error code %lu. Localized description: %@, and failure reason: %@", error.domain, (long)error.code, error.localizedDescription, error.localizedFailureReason);
  333. };
  334. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  335. UIPrinter *airPrinter = [UIPrinter printerWithURL:[NSURL URLWithString:appDelegate.printerURL] ];///*self.printer;*/
  336. [[UIPrinter printerWithURL:[NSURL URLWithString:appDelegate.printerURL]] contactPrinter:^(BOOL available)
  337. {
  338. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  339. if (available&& appDelegate.printerURL.length>0)
  340. {
  341. [airPrinterController printToPrinter:airPrinter completionHandler:completionHandler];
  342. NSLog(@"AIRPRINTER AVAILABLE");
  343. }
  344. else
  345. {
  346. // [airPrinterController presentFromRect:CGRectMake(0, 0, 300, 500) inView:self.view animated:YES completionHandler:
  347. //
  348. //
  349. //
  350. // // [printPicker presentAnimated:YES completionHandler:
  351. // ^(UIPrintInteractionController *printerController, BOOL userDidSelect, NSError *error)
  352. // {
  353. // if (userDidSelect)
  354. // {
  355. // NSString* sid= printerController.printInfo.printerID;
  356. // UIPrintPaper*paper= printerController.printPaper;
  357. //
  358. // }
  359. // }];
  360. NSLog(@"AIRPRINTER NOT AVAILABLE");
  361. if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1)
  362. {
  363. UIPrinterPickerController *printPicker = [UIPrinterPickerController printerPickerControllerWithInitiallySelectedPrinter:nil];
  364. // [printPicker presentFromBarButtonItem:self.btnSubmitOrder animated:yes completionHandler:
  365. [ printPicker presentFromBarButtonItem:self.btnshare animated:YES completionHandler:
  366. // [printPicker presentFromRect:CGRectMake(0, 0, 300, 500) inView:self.view animated:YES completionHandler:
  367. // [printPicker presentAnimated:YES completionHandler:
  368. ^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, NSError *error)
  369. {
  370. if (userDidSelect)
  371. {
  372. //User selected the item in the UIPrinterPickerController and got the printer details.
  373. [UIPrinterPickerController printerPickerControllerWithInitiallySelectedPrinter:printerPicker.selectedPrinter];
  374. //Here you will get the printer and printer details.ie,
  375. // printerPicker.selectedPrinter, printerPicker.selectedPrinter.displayName, printerPicker.selectedPrinter.URL etc. So you can display the printer name in your label text or button title.
  376. appDelegate.printerURL =printerPicker.selectedPrinter.URL.absoluteString;
  377. [self startAirPrintWithData:data];
  378. }
  379. else
  380. {
  381. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  382. // if([appDelegate.mode isEqualToString:@"Trade Show Mode"]&& appDelegate.submit_order_logout)
  383. // {
  384. //
  385. // [((MainViewController*)appDelegate.main_vc) Loginout:false];
  386. // }
  387. // [self prepareReturn:nil];
  388. //[self.navigationController popViewControllerAnimated:true];
  389. }
  390. }];
  391. }
  392. }
  393. }];
  394. }
  395. #pragma mark - UIPrintInteractionControllerDelegate
  396. - (UIPrintPaper *)printInteractionController:(UIPrintInteractionController *)printInteractionController choosePaper:(NSArray<UIPrintPaper *> *)paperList
  397. {
  398. ;
  399. // (int) width = 29700
  400. // Printing description of (*( (int *)0x7caa3a40)):
  401. // (int) height = 42000
  402. //设置纸张大小
  403. for(UIPrintPaper* paper in paperList)
  404. {
  405. if (CGSizeEqualToSize(paper.paperSize, CGSizeMake(612, 792)))
  406. return paper;
  407. }
  408. CGSize paperSize = CGSizeMake(612, 792);
  409. UIPrintPaper * p=[UIPrintPaper bestPaperForPageSize:paperSize withPapersFromArray:paperList];
  410. return p;
  411. }
  412. - (void)printInteractionControllerWillPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
  413. {
  414. }
  415. - (void)printInteractionControllerDidPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
  416. {
  417. }
  418. - (void)printInteractionControllerWillDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController
  419. {
  420. }
  421. - (void)printInteractionControllerDidDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController
  422. {
  423. }
  424. - (void)printInteractionControllerWillStartJob:(UIPrintInteractionController *)printInteractionController
  425. {
  426. }
  427. - (void)printInteractionControllerDidFinishJob:(UIPrintInteractionController *)printInteractionController
  428. {
  429. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  430. // if([appDelegate.mode isEqualToString:@"Trade Show Mode"]&& appDelegate.submit_order_logout)
  431. // {
  432. //
  433. // [((MainViewController*)appDelegate.main_vc) Loginout:false];
  434. // }
  435. //
  436. // [self prepareReturn:nil];
  437. if(self.autoPrint)
  438. [self.navigationController popViewControllerAnimated:true];
  439. }
  440. @end