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

Freehand drawing Bezier path

More
IP: 192.168.0.71 11 years 6 months ago #6863 by Mahesh007
for getting annotation rectangale we have used -(void)getRect:(PDF_RECT *)rect method.
but what is tha parameter of rect. please help on this.
More
IP: 192.168.0.71 11 years 6 months ago #6865 by radaee
Replied by radaee on topic Freehand drawing Bezier path
like this:
PDF_RECT rect;
[annot getRect:&rect];

rect is in PDF coordinate, convert to bitmap coordinate like:

rect.left *= scale;
rect.right *= scale;
float height = [PDFPage getHeight];
float tmp - rect.top;
rect.top = (height - rect.bottom) * scale;
rect.bottom = (height - tmp) * scale;
More
IP: 192.168.0.71 11 years 6 months ago #6867 by Mahesh007
PDF_RECT rect;
[annot getRect:&rect];
NSLog(@"rectangle %f,%f,%f,%f",rect.top,rect.bottom,rect.left,rect.right);
o/p - 124.070862,267.284729,103.900085,402.496216
but these are wrong cordinate please suggest me if m i doing any wrong implementation.
i want to get annotation frame size on annotation click.
-(void)OnAnnotClicked:(PDFPage *)page :(PDFAnnot *)annot :(float)x :(float)y
in this method
More
IP: 192.168.0.71 11 years 6 months ago #6869 by radaee
Replied by radaee on topic Freehand drawing Bezier path
get annotation rect codes like(in [PDFView onSingleTap])
Code:
[m_annot getRect:&m_annot_rect]; m_annot_rect.left = [vpage GetX] - self.contentOffset.x * m_scale + [vpage ToDIBX:m_annot_rect.left]; m_annot_rect.right = [vpage GetX] - self.contentOffset.x * m_scale + [vpage ToDIBX:m_annot_rect.right]; float tmp = m_annot_rect.top; m_annot_rect.top = [vpage GetY] - self.contentOffset.y * m_scale + [vpage ToDIBY:m_annot_rect.bottom]; m_annot_rect.bottom = [vpage GetY] - self.contentOffset.y * m_scale + [vpage ToDIBY:tmp];
and draw rect like:
Code:
-(void)drawAnnot:(CGContextRef)context { if( m_status == sta_annot ) { int dx = m_tx - m_px; int dy = m_ty - m_py; CGContextSetLineWidth(context, 1); CGContextSetRGBStrokeColor(context, 0, 0, 0, 1); CGRect rect1 = CGRectMake(self.contentOffset.x + (m_annot_rect.left+dx)/m_scale, self.contentOffset.y + (m_annot_rect.top+dy)/m_scale, (m_annot_rect.right - m_annot_rect.left)/m_scale, (m_annot_rect.bottom - m_annot_rect.top)/m_scale); CGContextStrokeRect(context, rect1); } }
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #6874 by Mahesh007
I am using your code from your give step but this gives me wrong cordinate like this.
PDFVPage *pg =[[PDFVPage alloc] init:m_doc :2];
PDF_RECT rect;
float m_scale = [[UIScreen mainScreen] scale];
[annot getRect:&rect];
rect.left = [pg GetX] - m_view.contentOffset.x * m_scale + [pg ToDIBX:rect.left];
rect.right = [pg GetX] - m_view.contentOffset.x * m_scale + [pg ToDIBX:rect.right];
float tmp = rect.top;
rect.top = [pg GetY] - m_view.contentOffset.y * m_scale + [pg ToDIBY:rect.bottom];
rect.bottom = [pg GetY] - m_view.contentOffset.y * m_scale + [pg ToDIBY:tmp];
-2
906
-2
906
if am i doing wrong please suggest me.i want to know annotation frame area. actually i want to capture frame (annotation area) so i will convert into image. please help on this asap.








i have print rect this gives me

m_annot_rect = {
left = 103.89996
top = 124.48999
right = 402.49994

bottom = 267.70996
}


please look mahesh (ink annotation) area. this does not match with area
Last edit: 11 years 6 months ago by felipe1234. Reason: Add some description.
Time to create page: 0.391 seconds
Powered by Kunena Forum