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

TOPIC:

how to add a picture 8 years 9 months ago #9356

  • ecosignitchile
  • ecosignitchile's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
  • Thank you received: 0
Hi , i need to add a picture like a stamp ... what is the method to do it ?

thanks !

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

how to add a picture 8 years 8 months ago #9365

  • stronglee
  • stronglee's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 93
  • Thank you received: 2
Hi, PDFPage class have method
-(bool)addAnnotBitmap:(CGImageRef) bitmap :(bool) has_alpha :(const PDF_RECT *) rect;
have try :)

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

how to add a picture 8 years 8 months ago #9377

  • ecosignitchile
  • ecosignitchile's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
  • Thank you received: 0
thanks ! can you show me an example please : ) ???

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

how to add a picture 8 years 8 months ago #9382

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
Hi,

here is an example to add a picture in the current page (you can add this method in PDFView class):
- (void)vAddImage:(NSString *)image withRect:(PDF_RECT)rect
{
    NSString *tp = NSTemporaryDirectory();
    tp = [tp stringByAppendingPathComponent:@"cache.dat"];
    [m_doc setCache:tp];
    
    PDFPage *page = [m_doc page:m_cur_page];
    
    CGImageRef ref = [[UIImage imageNamed:image] CGImage];
    
    [page addAnnotBitmap:ref :NO :&rect];
    
    [m_view vRenderSync:m_cur_page];
    [self refresh];
    [m_doc save];
}

the first part set the cache file (is needed to add an image).

I tried that method with this simple code:
PDF_RECT rect;
    
    rect.left = 100;
    rect.right = 57;
    rect.top = 100;
    rect.bottom = 57;
    
    [m_view vAddImage:@"icon57.png" withRect:rect];

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

how to add a picture 8 years 8 months ago #9384

  • ecosignitchile
  • ecosignitchile's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 10
  • Thank you received: 0
thanks i get errors on this lines :

[m_view vRenderSync:m_cur_page];
where do i get page number ?

[m_view vRenderSync:m_cur_page];
vRenderSync this method looks like doesn't exist
[self refresh];
dont know : )

thanks !

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

how to add a picture 8 years 8 months ago #9385

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
To use this method without errors, you should add it in PDFView.m

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum