Can you just reply little fast what i am doing wrong after i have added the above code in PDFview.m file in objc and calling this function using the delegate from swift project but unable to see the annotation.
to add a new method, starting from PDFView class, you should add the method in:
- PDFView class: add and implement the new method.
- RDPDFViewController: add new method the calls the PDFView class' method.
- RadaeePDFPlugin: add new method the calls the RDPDFViewController class' method.
Then build the lib project and replace the RadaeePDFPlugin.h into your project, run the make command to create the new lib and replace the old one into your project.
Please be sure to use your method when the pdf file is opened, as it's using vpage instance.
If you want to add annotation using the PDF coordinate system you should use something like:
// get the page from doc
PDFPage *page = [m_doc page:0];
// customize this part to modify the rect size and position
int x = 50; // left
int y = 200; // top
int width = 200;
int height = 100;
// create rect in pdf coordinate system
rect.left = x;
rect.right = x + width;
rect.top = y;
rect.bottom = y + height;
// add the annotation
[page addAnnotRect:&rect: g_rect_Width * m_scale / [m_view vGetScaleMin:0]: g_rect_color: 0];
// refresh the page
If you want to add the annotation when the pdf file is closed (only PDF coordinate system) you should also:
- open it with a PDFDoc instance (Ex. [m_doc open:*pdfPath* :*password*]
- remove [self refresh] at the end of the method
- add [m_doc save]; at the end of the method