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

Create custom Annotation from coordinates

More
IP: 211.24.100.120 7 years 2 months ago #14208 by Faris
Hi support team,

I would like to create custom rectangular annotations, based on coordinates received (x, y, height, width) , programmatically on the PDF files when the viewer started.
Would also want the annotations to be clickable to do some actions (open a new view controller / alertDialog etc.)

For example,
I would like to annotate the text like in attachment picture, and the user will be only able to click on them but can't do any editing.

Would like ask the support team whether this possible with radaeepdf kit?

Thanks in advance,
Faris
More
IP: 212.97.62.176 7 years 2 months ago #14212 by emanuele
Dear Faris,

if you want to add an annotation using the view coordinate system, you can add this slice of code in PDFView class and customize it based on your needs:
Code:
// get the vpage to calculate the annot size based on current scale value PDFVPage *vpage = [m_view vGetPage:0]; PDFPage *page = [vpage GetPage]; // customize this part to modify the rect size and position int x = 50; int y = 100; int width = 500; int height = 100; // convert the coordinate system from screen to pdf struct PDFV_POS pos1; struct PDFV_POS pos2; [m_view vGetPos:&pos1 :(x - self.contentOffset.x) * m_scale :(y - self.contentOffset.y) * m_scale]; [m_view vGetPos:&pos2 :(x - self.contentOffset.x + width) * m_scale :(y - self.contentOffset.y + height) * m_scale]; PDF_RECT rect; rect.left = pos1.x; rect.right = pos2.x; rect.top = pos2.y; rect.bottom = pos1.y; // add the annotation [page addAnnotRect:&rect: g_rect_Width * m_scale / [m_view vGetScaleMin:0]: g_rect_color: 0]; // refresh the page [m_view vRenderSync:0]; [self refresh];

this code shows how to add a rect annotation on page 0, then you can add your custom action on OnAnnotClicked method of RDPDFViewController class
More
IP: 211.24.100.120 7 years 1 month ago #14229 by smgtechmobile
Hi Emanuele,

Can this annotation method be done on a Swift project?
More
IP: 212.97.62.176 7 years 1 month ago #14230 by emanuele
Hi,

the Swift module is distributed with the Obj-C lib project and you are free to add this feature and create a custom library with the make file.
Time to create page: 0.453 seconds
Powered by Kunena Forum