Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Word’s bounds |
Post Reply |
Author | |
Dmitry
Team Player Joined: 21 Sep 06 Status: Offline Points: 47 |
Post Options
Thanks(0)
Posted: 17 Nov 06 at 5:28AM |
Hi!
Please tell me how to define bounds(in pixels) of exact word. For example. I could get the bounds of exact line using function GetPageText(4): "PDMFNG+CMR10", {Font} #000000, {Color} 10.90, {Font Size} 72.0009,628.7132,512.1819,628.7132,512.1819,639.6223,72.0009,639.6223, {Bounds} "Although there is a long history of empirical research into the deformation behaviour of" {Text line} But how can I define the bounds of word 'history' for example? Edited by Dmitry |
|
ukobsa
Senior Member Joined: 29 May 06 Location: Germany Status: Offline Points: 115 |
Post Options
Thanks(0)
|
Hi Dmitry,
As far as I know: If GetPageText cannot split the text to single words then you can't. Maybe you can make the pdf available so that someone can debug it in source to see, why it can't splitt into single words and if there is a solution. best regards, Uli |
|
swb1
Debenu Quick PDF Library Expert Joined: 05 Dec 05 Location: United States Status: Offline Points: 100 |
Post Options
Thanks(0)
|
The PDF Specification allows for a virtually unlimited number of ways in which text can be laid out in a document all the way from one character at time to a paragraph wrapped down an entire page. This means that is nearly impossible to know for certain where a word is or that it even is a word using text extraction methods. The easiest solution to your problem lies in controlling how the document is created. If you have no control over that you are probably out of luck. |
|
Dmitry
Team Player Joined: 21 Sep 06 Status: Offline Points: 47 |
Post Options
Thanks(0)
|
Thanks to all. But what will say Ingo?
|
|
Dmitry
Team Player Joined: 21 Sep 06 Status: Offline Points: 47 |
Post Options
Thanks(0)
|
BTW, I just develope the next algorithm
ASentence := Text; //Sentence AWord := ErrorWord; // The word that needs to be underlined WPos := Pos(AWord, ASentence); BefWord := Copy(ASentence, 1, WPos-1); AfWord := Copy(ASentence, 1, WPos+Length(AWord)); BM:= TBitmap.Create; // Creating bitmap BM.Canvas.Font.Name:=FontName; BM.Canvas.Font.Size:=FontSize; WordBeginPos:=(BM.Canvas.TextWidth(BefWord)); WordEndPos:=(BM.Canvas.TextWidth(AfWord)); Afword:=IntToStr(WordEndPos); LTop := LineBounds.LeftTop.Y; LLeft := LineBounds.LeftTop.X+4; Qp.SetLineColor(1,0,0); // red Qp.DrawLine(LLeft+WordBeginPos,LTop,LLeft+WordEndPos,LTop); But this method defines the wrong begin and end positions of the AWord. Edited by Dmitry |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Dimitry!
I don't know much enough about pdf ;-) My thoughts are: You have the beginning point (pixel) of the string and you have the ending point (pixel) of the string... and you can get the length of the string... i think with a bit maths it should be possible to get the position of a special word you're searching for...? Best regards, Ingo Edited by Ingo |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store