External links

Anonimous's Avatar

Anonimous

21 Jun, 2011 04:31 PM

I am trying to use didReceiveURIRequest but am not getting anything when a link to another document is tapped. I added this code to the Kiosk.m sample:

-(void)didReceiveURIRequest: (NSString *)uri{

   NSLog("The link = %", uri);

}

I am new to Objective C programming and I am sure that I am missing something. Please any help you can give me will be appreciated.

  1. Support Staff 1 Posted by Matteo on 21 Jun, 2011 04:59 PM

    Matteo's Avatar

    Did you set your controller as MFDocumentViewControllerDelegate?

  2. 2 Posted by Anonimous on 24 Jun, 2011 09:52 AM

    Anonimous's Avatar

    Matteo,
    h1. Thank you for the quick response. I went back and tried to verify that everything is correct. As you can see below didGoToPage is set up the same and it works but the method didReceiveURIRequest does not.
    Both of these methods are declared in the MFDocumentViewControllerDelegate so both or neither should work in this same context. I am testing this in your sample code DocumentViewController.m. This is a feature that is very important to us.

    /* This method will notify if the user has tapped on a annotation with a remote uri action. This is usually invoked when an external
    link is activated and an internet browser should be open to show the link's content.
    /

      -(void)documentViewController:(MFDocumentViewController *)dvc didReceiveURIRequest:(NSString *)uri {
         NSLog("The URI tapped is %", uri);
        }
    
     -(void) documentViewController:(MFDocumentViewController *)dvc didGoToPage:(NSUInteger)page {
    
    //    Page has changed, either by user input or an internal change upon an event: update the label and the 
    //    slider to reflect that. If you save the current page as a bookmark to it is a good idea to store the value
    //    in this callback.
    
     [pageNumLabel setText:PAGE_NUM_LABEL_TEXT(page,[[self document]numberOfPages])];
    
     [pageSlider setValue:[[NSNumber numberWithUnsignedInteger:page]floatValue] animated:YES];
    
     [thumbsliderHorizontal goToPage:page-1 animated:YES];
    
     [self setNumberOfPageToolbar];
    
    }
    
  3. 3 Posted by Nicolò on 24 Jun, 2011 09:53 AM

    Nicolò's Avatar

    Hello

    What do you mean with 'link to another document'? Are you referring to link annotation to pages of other PDF documents? The kit at this stage only supports link annotation inside the same document and link to an external URL (basically the ones you can add using preview). If this is very important for you we can look into it and find a solution.

  4. 4 Posted by Anonimous on 24 Jun, 2011 09:54 AM

    Anonimous's Avatar

    Got it! I tested it with links I created in preview and it works great. Thanks you again for the quick response to my questions.

    I am interested in supporting links to other documents. I don't see a way to get a call-back for those currently. Do you need to update the parsing/rendering to handle these links? Or is there some way that I can get a call-back when a link to another PDF document is tapped?

    Thanks.

  5. Support Staff 5 Posted by Matteo on 24 Jun, 2011 09:55 AM

    Matteo's Avatar

    We are working to support links to external documents, actually this feature is not included.

    I am interested in supporting links to other documents. I don't see a way to get a   call-back for those currently. Do you need to update the parsing/rendering to handle  these links? Or is there some way that I can get a call-back when a link to another PDF document is tapped?
    
    Thanks.
    

    I've added this issue to GitHub Issues

  6. Matteo closed this discussion on 20 Jul, 2011 10:35 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac