Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

how to add a picture

More
10 years 6 months ago #9356 by ecosignitchile
Hi , i need to add a picture like a stamp ... what is the method to do it ?

thanks !
More
10 years 5 months ago #9365 by stronglee
Replied by stronglee on topic how to add a picture
Hi, PDFPage class have method
-(bool)addAnnotBitmap:(CGImageRef) bitmap :(bool) has_alpha :(const PDF_RECT *) rect;
have try :)
More
10 years 5 months ago #9377 by ecosignitchile
Replied by ecosignitchile on topic how to add a picture
thanks ! can you show me an example please : ) ???
More
10 years 5 months ago #9382 by emanuele
Replied by emanuele on topic how to add a picture
Hi,

here is an example to add a picture in the current page (you can add this method in PDFView class):
Code:
- (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:
Code:
PDF_RECT rect; rect.left = 100; rect.right = 57; rect.top = 100; rect.bottom = 57; [m_view vAddImage:@"icon57.png" withRect:rect];
More
10 years 5 months ago #9384 by ecosignitchile
Replied by ecosignitchile on topic how to add a picture
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 !
More
10 years 5 months ago #9385 by emanuele
Replied by emanuele on topic how to add a picture
To use this method without errors, you should add it in PDFView.m
Time to create page: 0.475 seconds
Powered by Kunena Forum