2

I use UIDocumentInteractionController presentOptionsMenuFromBarButtonItem to open PDF in Adobe Reader app, send it with Mail and print it. Mail and print work fine but I'm unable to open any other app. I tried presentOpenInMenuFromBarButtonItem and UIActivityViewController but neither of them do all I need.

I tried to open Adobe Reader with documentInteractionController: willBeginSendingToApplication: delegate but i'm unable to find how I can pass the pdf to the app. Is it possible?

If not, is there a another way to open PDF in Adobe Reader app, send it with Mail and print it?

Thanks

rmaddy
  • 314,917
  • 42
  • 532
  • 579
olivierplante
  • 185
  • 2
  • 11

1 Answers1

2

Normally this is how I do:

   NSURL *documentsDirectoryPath = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]];

    NSURL *URL =[documentsDirectoryPath URLByAppendingPathComponent:@"your pdf"];

    UIButton *button = (UIButton *)nil;
    self.documentInteractionController.delegate=self;
    if (URL) {
        // Initialize Document Interaction Controller
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
        // Configure Document Interaction Controller
        [self.documentInteractionController setDelegate:self];
        //preview
       [self.documentInteractionController presentPreviewAnimated:YES];
        // Present Open In Menu
        [self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];

    }
Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
  • Thank you for your answer but presentOpenInMenuFromRect works only with other apps (Adobe Reader opens without any problem). It don't show any option to send the document by mail or print it. – olivierplante Oct 15 '15 at 19:39
  • check this :http://stackoverflow.com/questions/23336363/uidocumentinteractioncontroller-does-not-show-mail-option – Teja Nandamuri Oct 15 '15 at 20:18
  • I already used presentOptionsMenuFromBarButtonItem (that was my first choice) but since a couple of time it doesn't open Adobe Reader (or any other apps). It only work for mail and print. I setted the UTI with documentController.UTI = @"com.adobe.pdf"; – olivierplante Oct 19 '15 at 11:58