PDFViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  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 navigationController] setNavigationBarHidden:self.hidenavi animated:NO];
  111. self.navigationItem.title = self.save_name;
  112. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
  113. // self.content=nil;
  114. if(self.content!=nil&&self.content.length>0)
  115. {
  116. [reF removeFromSuperview];
  117. // NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  118. NSString *path = NSTemporaryDirectory();
  119. NSString *filePath = [path stringByAppendingPathComponent:self.filename];
  120. // NSError *error = [[NSError alloc] init];
  121. // BOOL bo = [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
  122. // NSAssert(bo,@"创建目录失败");
  123. [self.content writeToFile:filePath atomically:YES];
  124. self.btnshare.enabled =true;
  125. self.btnemail.enabled =true;
  126. self.btnsave.enabled =true;
  127. if(self.onLoadSuccess)
  128. self.onLoadSuccess(self.url);
  129. if(self.autoPrint)
  130. [self startAirPrintWithData:self.content];
  131. // int a=0;
  132. }
  133. else
  134. {
  135. [RAUtils message_alert:nil title:@"Open PDF Failed" controller:self];
  136. if(self.autoPrint)
  137. [self.navigationController popViewControllerAnimated:true];
  138. // self.content = [self.url dataUsingEncoding:NSUTF8StringEncoding];
  139. }
  140. ;
  141. // NSLog(@"%@",[[NSString alloc] initWithData:self.content encoding:NSASCIIStringEncoding]);
  142. //
  143. [self.webView loadData:self.content MIMEType:urlResponse.MIMEType textEncodingName:nil baseURL:nil];
  144. });
  145. });
  146. }
  147. -(void)changeCell
  148. {
  149. UIRefreshControl *reF = (UIRefreshControl *)[self.view viewWithTag:200];
  150. reF.attributedTitle = [[NSAttributedString alloc]initWithString:@"refreshing"];
  151. if ([self respondsToSelector:@selector(ReloadData)])
  152. [self performSelector:@selector(ReloadData) withObject:nil afterDelay:1];
  153. // DebugLog(@"refresh!!!!!!!!");
  154. }
  155. - (void)didReceiveMemoryWarning
  156. {
  157. [super didReceiveMemoryWarning];
  158. // Dispose of any resources that can be recreated.
  159. }
  160. -(void) viewWillAppear:(BOOL)animated
  161. {
  162. [super viewWillAppear:animated];
  163. [[self navigationController] setNavigationBarHidden:self.hidenavi animated:NO];
  164. }
  165. - (IBAction)onActionClick:(id)sender {
  166. //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  167. NSString *path = NSTemporaryDirectory();
  168. NSString* filename =self.filename;
  169. NSString *filePath = [path stringByAppendingPathComponent:filename];
  170. [self openFile:filePath];
  171. }
  172. - (IBAction)onSaveClick:(id)sender {
  173. //UIAlertControllerStyle两种类型UIAlertControllerStyleAlert类似UIAlertView
  174. //UIAlertControllerStyleActionSheet类似UIActionSheet
  175. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Save pdf" message:nil preferredStyle:UIAlertControllerStyleAlert];
  176. //block代码块取代了delegate
  177. [alertControl addTextFieldWithConfigurationHandler:^(UITextField *textField) {
  178. textField.text = self.save_name;
  179. }];
  180. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Save" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  181. UITextField *name = alertControl.textFields.firstObject;
  182. if(name.text.length==0)
  183. {
  184. [RAUtils message_alert:@"Cannot save without name. Save canceled." title:@"Name is missing" controller:self];
  185. }
  186. else
  187. {
  188. self.save_name = name.text;
  189. self.btnsave.enabled =false;
  190. // NSMutableDictionary * info =
  191. if(self.onSavePDF)
  192. self.onSavePDF(self.save_name,self.filename);
  193. }
  194. }];
  195. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  196. NSLog(@"Cancel");
  197. }];
  198. [alertControl addAction:actionOne];
  199. [alertControl addAction:alertthree];
  200. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  201. [self presentViewController:alertControl animated:YES completion:nil];
  202. }
  203. - (IBAction)onEmailClick:(id)sender {
  204. //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  205. NSString *path = NSTemporaryDirectory();
  206. NSString* filename =self.filename;
  207. NSString *filePath = [path stringByAppendingPathComponent:filename];
  208. MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
  209. if(mc==nil)
  210. {
  211. //[RAUtils message_alert:@"You must create an email account first." title:@"Send Email" controller:self];
  212. return;
  213. }
  214. mc.mailComposeDelegate = self;
  215. [mc setSubject:self.mail_subject];
  216. [mc setToRecipients:self.mail_to];
  217. if(self.mail_content==nil)
  218. self.mail_content=@"";
  219. NSString* htmlbody = [NSString stringWithFormat:@"<html><p>%@</p></html>",self.mail_content];
  220. [mc setMessageBody:htmlbody
  221. isHTML:YES];
  222. NSData *data = [NSData dataWithContentsOfFile:filePath];
  223. if(self.attachment_name.length>0)
  224. filename = self.attachment_name;
  225. [mc addAttachmentData:data mimeType:@"application/pdf" fileName:filename];
  226. [self presentModalViewController:mc animated:YES];
  227. return;
  228. }
  229. -(void)openFile: (NSString *) file_url {
  230. NSURL *file_URL = [NSURL fileURLWithPath:file_url];
  231. if (file_URL != nil) {
  232. if (self.fileInteractionController == nil) {
  233. //_fileInteractionController = [[UIDocumentInteractionController alloc] init];
  234. _fileInteractionController = [UIDocumentInteractionController interactionControllerWithURL:file_URL];
  235. _fileInteractionController.delegate = self;
  236. // [_fileInteractionController retain];//不适用ARC,记得RETAIN 使用ARC注释这一行
  237. }
  238. else
  239. {
  240. self.fileInteractionController.URL = file_URL;
  241. }
  242. // [self.fileInteractionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
  243. [self.fileInteractionController setName:self.mail_subject];
  244. // [self.fileInteractionController setAnnotation:<#(id _Nullable)#>;
  245. [self.fileInteractionController presentOptionsMenuFromBarButtonItem:self.btnshare animated:YES];
  246. // [self.fileInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
  247. // [self.fileInteractionController presentPreviewAnimated:YES];
  248. }
  249. }
  250. //- (void) sendEmail:(NSString *)to cc:(NSString*)cc subject:(NSString*)subject body:(NSString*)body
  251. //{
  252. // NSString* str = [NSString stringWithFormat:@"mailto:%@?cc=%@&subject=%@&body=%@",
  253. // to, cc, subject, body];
  254. // str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  255. //
  256. // [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
  257. //
  258. //
  259. //}
  260. #pragma mark methods for the UIDocumentInteractionControllerDelegate
  261. - (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller
  262. {
  263. // if (controller == self.fileInteractionController) {
  264. // self.fileInteractionController = nil;
  265. // }
  266. }
  267. - (void)previewDocumentWithURL:(NSURL*)url
  268. {
  269. UIDocumentInteractionController* preview = [UIDocumentInteractionController interactionControllerWithURL:url];
  270. preview.delegate = self;
  271. [preview presentPreviewAnimated:YES];
  272. }
  273. - (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
  274. {
  275. }
  276. - (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller{
  277. return self;
  278. }
  279. - (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller{
  280. return self.view.frame;
  281. }
  282. - (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller{
  283. return self.view;
  284. }
  285. - (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(nullable NSString *)application // bundle ID
  286. {
  287. }
  288. #pragma mark - web view delegate
  289. - (void)webViewDidFinishLoad:(UIWebView *)webView
  290. {
  291. self.mum.hidden=true;
  292. }
  293. #pragma mark -MFMailComposeViewControllerDelegate delegate
  294. - (void)mailComposeController:(MFMailComposeViewController*)controller
  295. didFinishWithResult:(MFMailComposeResult)result
  296. error:(NSError*)error {
  297. switch (result)
  298. {
  299. case MFMailComposeResultCancelled:
  300. NSLog(@"Mail send canceled...");
  301. break;
  302. case MFMailComposeResultSaved:
  303. NSLog(@"Mail saved...");
  304. break;
  305. case MFMailComposeResultSent:
  306. NSLog(@"Mail sent...");
  307. break;
  308. case MFMailComposeResultFailed:
  309. NSLog(@"Mail send errored: %@...", [error localizedDescription]);
  310. break;
  311. default:
  312. break;
  313. }
  314. [self dismissModalViewControllerAnimated:YES];
  315. }
  316. /*
  317. #pragma mark - Navigation
  318. In a storyboard-based application, you will often want to do a little preparation before navigation
  319. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  320. {
  321. Get the new view controller using [segue destinationViewController].
  322. Pass the selected object to the new view controller.
  323. }
  324. */
  325. - (void)startAirPrintWithData:(id )data
  326. {
  327. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"preparing print..."];
  328. UIPrintInteractionController* airPrinterController=[UIPrintInteractionController sharedPrintController];
  329. UIPrintInfo *printInfo = [UIPrintInfo printInfo];
  330. printInfo.outputType = UIPrintInfoOutputGeneral;
  331. printInfo.orientation = UIPrintInfoOrientationPortrait;
  332. printInfo.jobName = @"CoolVisitAirPrint";
  333. airPrinterController.printInfo = printInfo;
  334. airPrinterController.printingItem = data;
  335. airPrinterController.delegate = self;
  336. airPrinterController.showsNumberOfCopies=true;
  337. airPrinterController.showsPageRange = true;
  338. airPrinterController.showsPaperSelectionForLoadedPapers=true;
  339. void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
  340. if(completed && error)
  341. 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);
  342. };
  343. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  344. UIPrinter *airPrinter = [UIPrinter printerWithURL:[NSURL URLWithString:appDelegate.printerURL] ];///*self.printer;*/
  345. [[UIPrinter printerWithURL:[NSURL URLWithString:appDelegate.printerURL]] contactPrinter:^(BOOL available)
  346. {
  347. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  348. if (available&& appDelegate.printerURL.length>0)
  349. {
  350. [airPrinterController printToPrinter:airPrinter completionHandler:completionHandler];
  351. NSLog(@"AIRPRINTER AVAILABLE");
  352. }
  353. else
  354. {
  355. // [airPrinterController presentFromRect:CGRectMake(0, 0, 300, 500) inView:self.view animated:YES completionHandler:
  356. //
  357. //
  358. //
  359. // // [printPicker presentAnimated:YES completionHandler:
  360. // ^(UIPrintInteractionController *printerController, BOOL userDidSelect, NSError *error)
  361. // {
  362. // if (userDidSelect)
  363. // {
  364. // NSString* sid= printerController.printInfo.printerID;
  365. // UIPrintPaper*paper= printerController.printPaper;
  366. //
  367. // }
  368. // }];
  369. NSLog(@"AIRPRINTER NOT AVAILABLE");
  370. if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1)
  371. {
  372. UIPrinterPickerController *printPicker = [UIPrinterPickerController printerPickerControllerWithInitiallySelectedPrinter:nil];
  373. // [printPicker presentFromBarButtonItem:self.btnSubmitOrder animated:yes completionHandler:
  374. [ printPicker presentFromBarButtonItem:self.btnshare animated:YES completionHandler:
  375. // [printPicker presentFromRect:CGRectMake(0, 0, 300, 500) inView:self.view animated:YES completionHandler:
  376. // [printPicker presentAnimated:YES completionHandler:
  377. ^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, NSError *error)
  378. {
  379. if (userDidSelect)
  380. {
  381. //User selected the item in the UIPrinterPickerController and got the printer details.
  382. [UIPrinterPickerController printerPickerControllerWithInitiallySelectedPrinter:printerPicker.selectedPrinter];
  383. //Here you will get the printer and printer details.ie,
  384. // printerPicker.selectedPrinter, printerPicker.selectedPrinter.displayName, printerPicker.selectedPrinter.URL etc. So you can display the printer name in your label text or button title.
  385. appDelegate.printerURL =printerPicker.selectedPrinter.URL.absoluteString;
  386. [self startAirPrintWithData:data];
  387. }
  388. else
  389. {
  390. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  391. // if([appDelegate.mode isEqualToString:@"Trade Show Mode"]&& appDelegate.submit_order_logout)
  392. // {
  393. //
  394. // [((MainViewController*)appDelegate.main_vc) Loginout:false];
  395. // }
  396. // [self prepareReturn:nil];
  397. //[self.navigationController popViewControllerAnimated:true];
  398. }
  399. }];
  400. }
  401. }
  402. }];
  403. }
  404. #pragma mark - UIPrintInteractionControllerDelegate
  405. - (UIPrintPaper *)printInteractionController:(UIPrintInteractionController *)printInteractionController choosePaper:(NSArray<UIPrintPaper *> *)paperList
  406. {
  407. ;
  408. // (int) width = 29700
  409. // Printing description of (*( (int *)0x7caa3a40)):
  410. // (int) height = 42000
  411. //设置纸张大小
  412. for(UIPrintPaper* paper in paperList)
  413. {
  414. if (CGSizeEqualToSize(paper.paperSize, CGSizeMake(612, 792)))
  415. return paper;
  416. }
  417. CGSize paperSize = CGSizeMake(612, 792);
  418. UIPrintPaper * p=[UIPrintPaper bestPaperForPageSize:paperSize withPapersFromArray:paperList];
  419. return p;
  420. }
  421. - (void)printInteractionControllerWillPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
  422. {
  423. }
  424. - (void)printInteractionControllerDidPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController
  425. {
  426. }
  427. - (void)printInteractionControllerWillDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController
  428. {
  429. }
  430. - (void)printInteractionControllerDidDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController
  431. {
  432. }
  433. - (void)printInteractionControllerWillStartJob:(UIPrintInteractionController *)printInteractionController
  434. {
  435. }
  436. - (void)printInteractionControllerDidFinishJob:(UIPrintInteractionController *)printInteractionController
  437. {
  438. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  439. // if([appDelegate.mode isEqualToString:@"Trade Show Mode"]&& appDelegate.submit_order_logout)
  440. // {
  441. //
  442. // [((MainViewController*)appDelegate.main_vc) Loginout:false];
  443. // }
  444. //
  445. // [self prepareReturn:nil];
  446. if(self.autoPrint)
  447. [self.navigationController popViewControllerAnimated:true];
  448. }
  449. @end