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

TOPIC:

How to remove image from pdf? 6 years 1 month ago #13550

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

{
// Get page
PDFPage *page = [m_doc page:2];

// Create page content
PDFPageContent *content = [[PDFPageContent alloc] init];

// Get the image to add
UIImage *img = [UIImage imageNamed:@"pink"];

// Create a Doc Image instance
PDFDocImage *_image = [m_doc newImage:img.CGImage :YES];

// Add the image as page resource
PDF_PAGE_IMAGE rimg = [page addResImage:_image];
[content gsSave];

// Set the matrix (image position/size on page)
PDFMatrix *matrix = [[PDFMatrix alloc] init:20 :20 :20:20];
[content gsCatMatrix:matrix];
matrix = nil;

// Draw the image on page content
[content drawImage:rimg];
[content gsRestore];

// Add the content on the page
[page addContent:content :true];

// Save the file
[m_doc save];
}


Image is added to the pdf, but on some event this image need to be removed. How can I do that?

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

How to remove image from pdf? 6 years 1 month ago #13551

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 261
  • Thank you received: 18
Hi,
Adding image in PDF like you do makes the image an integral part of the PDF and so you can't delete it. You should add image like annot if you want to remove it, so you could use this PDFView's method
- (void)vAddImageWithImage:(UIImage *)image withRect:(PDF_RECT)rect;
on event that you prefer.

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

How to remove image from pdf? 6 years 1 month ago #13553

  • doubleeye
  • doubleeye's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
- (void)vAddImageWithImage:(UIImage *)image withRect:(PDF_RECT)rect;
in My pdfview file , there is no method with this name.

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

How to remove image from pdf? 6 years 1 month ago #13554

  • doubleeye
  • doubleeye's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
- (void)vAddImageWithImage:(UIImage *)image withRect:(PDF_RECT)rect;
in My pdfview file , there is no method with this name.

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

How to remove image from pdf? 6 years 1 month ago #13581

  • federico
  • federico's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 261
  • Thank you received: 18
Hi,
You could check our knowledgebase here to add an image as annot

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

How to remove image from pdf? 6 years 1 month ago #13583

  • doubleeye
  • doubleeye's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 21
  • Thank you received: 0
Hi,
Thanks for your response , but my Query was about how to remove image added to pdf.

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum