- Posts: 1123
- Thank you received: 73
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
OnPDFSelectEnd return text without white spaces
IP: 111.196.240.216
5 years 7 months ago - 5 years 7 months ago #15405
by radaee
Replied by radaee on topic OnPDFSelectEnd return text without white spaces
dear user:
it is possible manage on java layer, if you can manage UTF-16.
that Page.ObjsGetString(0, objsCharCount) return whole string value of page, and index of each char in this string shall be in UTF16 order.
another method Page.ObjsGetCharRect() return rectangle of each char.
that mean, you can judge by own, using char rect and space between 2 chars.
but in this way, you shall manage UTF-16 code by yourself.
it is possible manage on java layer, if you can manage UTF-16.
that Page.ObjsGetString(0, objsCharCount) return whole string value of page, and index of each char in this string shall be in UTF16 order.
another method Page.ObjsGetCharRect() return rectangle of each char.
that mean, you can judge by own, using char rect and space between 2 chars.
but in this way, you shall manage UTF-16 code by yourself.
Last edit: 5 years 7 months ago by radaee.
- thiagopelikan
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 36
- Thank you received: 0
IP: 177.194.84.112
5 years 1 week ago #15622
by thiagopelikan
Replied by thiagopelikan on topic OnPDFSelectEnd return text without white spaces
Could you give me an example how to do this?
For example, in the attached file, the ObjsGetString method gives me:
"TORCIDA T U M U L T U A AMBIENTE"
As I see, the 3 lines in the example are exactly with the same space between the chars
How can I use ObjsGetCharRect and extract the word from a RECT?
Tks,
Thiago
For example, in the attached file, the ObjsGetString method gives me:
"TORCIDA T U M U L T U A AMBIENTE"
As I see, the 3 lines in the example are exactly with the same space between the chars
How can I use ObjsGetCharRect and extract the word from a RECT?
Tks,
Thiago
IP: 111.196.242.56
5 years 1 week ago - 5 years 1 week ago #15623
by radaee
Replied by radaee on topic OnPDFSelectEnd return text without white spaces
dear user,
i'm still not sure what you really want.
i share some codes here。
for example, you want get char code and rectangle area of a char by index:
i'm still not sure what you really want.
i share some codes here。
for example, you want get char code and rectangle area of a char by index:
Code:
String sval = page.ObjsGetString(start, end);
float[] rect = new float[4];
for( int i = start; i < end; i++)
{
char code = sval.charAt(i - start);//encoding as UTF16.
page.ObjsGetCharRect(i, rect);//array as [left,top,right,bottom].
//todo: process each char.
}
Last edit: 5 years 1 week ago by radaee.
IP: 2.234.168.74
5 years 1 week ago #15624
by support
Replied by support on topic OnPDFSelectEnd return text without white spaces
Dear Thiago, your issue seems to be related to the way your test pdf file was generated and how chars are spaced on the page.
May you provide the file, please?
May you provide the file, please?
- thiagopelikan
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 36
- Thank you received: 0
IP: 177.194.84.112
5 years 1 week ago #15625
by thiagopelikan
Replied by thiagopelikan on topic OnPDFSelectEnd return text without white spaces
Hi, I had to upload the file to my repository because it has 6MB.
itgames-my.sharepoint.com/:b:/g/personal...zre9kwNyt5w?e=3dSTOv
Tks,
Thiago
itgames-my.sharepoint.com/:b:/g/personal...zre9kwNyt5w?e=3dSTOv
Tks,
Thiago
IP: 111.196.242.56
5 years 1 week ago #15626
by radaee
Replied by radaee on topic OnPDFSelectEnd return text without white spaces
Hi, we checked this PDF file, and tested in last version of Edge(chrome core).
the extracted text is:
TORCIDA
T U M U LT U A
AMBIENTE
also, we tested in PDF XChange pro, it is same to Edge.
this is depends on blank judgement of PDF software.
the extracted text is:
TORCIDA
T U M U LT U A
AMBIENTE
also, we tested in PDF XChange pro, it is same to Edge.
this is depends on blank judgement of PDF software.
Time to create page: 0.381 seconds