Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

Perform action when tap on image added to pdf. 6 years 1 month ago #13563

  • doubleeye
  • doubleeye's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
Hi I have added image to PDF using below method

- (void)vAddImageWithImage:(UIImage *)image withRect:(PDF_RECT)rect
{
// Create the cache file
NSString *tp = NSTemporaryDirectory();
tp = [tp stringByAppendingPathComponent:@"cache.dat"];
[m_doc setCache:tp];

// Create the PDFPage instance of the current page
PDFPage *page = [m_doc page:currentPage];

// Create the CGImageRef of the image
CGImageRef ref = [image CGImage];

PDFDocImage * docImage = [m_doc newImage:ref :YES];
// Add the image
[page addAnnotBitmap:docImage :&rect];

// Re-render the current page
[m_view vRenderSync:currentPage];
[self refresh];

// Save the PDF file
// [m_doc save];
}

Now I want to perform action when user tap on that image , is there any way I can achieve that?

Please Log in or Create an account to join the conversation.

Last edit: by doubleeye.

Perform action when tap on image added to pdf. 6 years 1 month ago #13565

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 261
  • Thank you received: 18
Hi,
I suggest you to use this method from RDPFViewController class:
-(void)OnAnnotClicked:(PDFPage *)page :(PDFAnnot *)annot :(float)x :(float)y;
In this method you could get the annot clicked and so you could check if the annot's types are the same:
if (annot.type == yourImgAnnot.type)
{
//do something
}
or you could check if the annot's objects are the same:
if (annot == yourImgAnnot)
{
//do something
}
The following user(s) said Thank You: doubleeye

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum