- Posts: 10
- Thank you received: 0
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 get startIndex and endIndex of highlighted text in PDF
- joshnaAppcare
- Topic Author
- Offline
- New Member
-
Less
More
IP: 192.168.0.71
8 years 3 months ago #13166
by joshnaAppcare
Get StartIndex and EndIndex of highlighted text was created by joshnaAppcare
hi, how can i get startIndex and endIndex of highlighted text so that i can store in data base and again show the highlighted text in swift...
can any one suggest to get the start point and end point in page..
Thankyou.
can any one suggest to get the start point and end point in page..
Thankyou.
IP: 192.168.0.71
8 years 1 month ago #13397
by josgou
Replied by josgou on topic how to get startIndex and endIndex of highlighted text in PDF
hi i want to store in my database start and end index of highlighted text so that i want to recreate the highlight..
public func onSelEnd(_ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) {
posx1 = Int(x1)
posy1 = Int(y1)
posx2 = Int(x2)
posy2 = Int(y2)
let m_scale = UIScreen.main.scale
let startIndex = pdfPage.objsGetCharIndex(Float(posx1 * Int(m_scale)), Float(posy1 * Int(m_scale)))
let endIndex = pdfPage.objsGetCharIndex(Float(posx2/Int(m_scale)), Float(posy2/Int(m_scale)))
but aim getting different location in pdf highlight can any one help me
public func onSelEnd(_ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) {
posx1 = Int(x1)
posy1 = Int(y1)
posx2 = Int(x2)
posy2 = Int(y2)
let m_scale = UIScreen.main.scale
let startIndex = pdfPage.objsGetCharIndex(Float(posx1 * Int(m_scale)), Float(posy1 * Int(m_scale)))
let endIndex = pdfPage.objsGetCharIndex(Float(posx2/Int(m_scale)), Float(posy2/Int(m_scale)))
but aim getting different location in pdf highlight can any one help me
- joshnaAppcare
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
IP: 192.168.0.71
8 years 1 month ago #13398
by joshnaAppcare
Replied by joshnaAppcare on topic Get StartIndex and EndIndex of highlighted text
public func onSelEnd(_ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) {
posx1 = Int(x1)
posy1 = Int(y1)
posx2 = Int(x2)
posy2 = Int(y2)
let m_scale = UIScreen.main.scale
let startIndex = pdfPage.objsGetCharIndex(Float(posx1 * Int(m_scale)), Float(posy1 * Int(m_scale)))
let endIndex = pdfPage.objsGetCharIndex(Float(posx2/Int(m_scale)), Float(posy2/Int(m_scale)))
but aim getting different location in pdf highlight can any one help me
posx1 = Int(x1)
posy1 = Int(y1)
posx2 = Int(x2)
posy2 = Int(y2)
let m_scale = UIScreen.main.scale
let startIndex = pdfPage.objsGetCharIndex(Float(posx1 * Int(m_scale)), Float(posy1 * Int(m_scale)))
let endIndex = pdfPage.objsGetCharIndex(Float(posx2/Int(m_scale)), Float(posy2/Int(m_scale)))
but aim getting different location in pdf highlight can any one help me
IP: 192.168.0.71
8 years 1 month ago #13400
by federico
Replied by federico on topic Get StartIndex and EndIndex of highlighted text
Hi,
I suggest you to take a look in PDFView class at the OnSelTouchEnd method:
This method get the rect of the selected text in pdf's coordinates.
If you want to get indexes you can add in PDFVPage class two methods:
And when you want to reuse them just call the method addAnnotMarkup and passing indexes
I suggest you to take a look in PDFView class at the OnSelTouchEnd method:
Code:
PDF_RECT rect = [vpage GetSelRect];
If you want to get indexes you can add in PDFVPage class two methods:
Code:
- (int)GetSelStartIndex
{
return [m_sel getStartIndex];
}
- (int)GetSelEndIndex
{
return [m_sel getEndIndex];
}
- joshnaAppcare
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
IP: 192.168.0.71
8 years 1 month ago #13415
by joshnaAppcare
Replied by joshnaAppcare on topic Get StartIndex and EndIndex of highlighted text
hi,
I have place these two methods in PDFVPage but its showing as "No visible @interface for 'PDFVSel' declares the selector 'getStartIndex'" and No visible @interface for 'PDFVSel' declares the selector 'getEndIndex'
I have place these two methods in PDFVPage but its showing as "No visible @interface for 'PDFVSel' declares the selector 'getStartIndex'" and No visible @interface for 'PDFVSel' declares the selector 'getEndIndex'
IP: 192.168.0.71
8 years 1 month ago #13418
by federico
Replied by federico on topic Get StartIndex and EndIndex of highlighted text
Hi,
Try to add this code PDFVPage.h in the PDFVSel inferface:
and so these methods will be visible to others classes.
Try to add this code PDFVPage.h in the PDFVSel inferface:
Code:
@interface PDFVSel : NSObject
//some other code
- (int)getStartIndex;
- (int)getEndIndex;
@end
Time to create page: 0.430 seconds