Yeah, that's what I'm doing now. Like a Taiwanese coder and writer once said, there is no secret in the source code. I'm diving into it.
-------------------------------------------------- From: "Mike Marchywka" <[email protected]> Sent: Thursday, April 09, 2009 12:08 AM To: <[email protected]> Subject: Re: [iText-questions] [edited] How to locate a certain range of text > > > > > ---------------------------------------- >> From: [email protected] >> To: [email protected] >> Date: Wed, 8 Apr 2009 23:36:44 +0800 >> Subject: Re: [iText-questions] [edited] How to locate a certain range of >> text >> >> Oh, thank you.It's very kind of you to show me the source code. Thanks. >> Though for now I don't quite understand your code. >> Thing is, I can get the position of the text. It's page no, X coordinate, >> Y coordinate, height, width, line no, start character index, end >> character >> index, etc. But how can I access the text which is confined in this area? >> The thing I want to do is to add action to it, be it goto a web page, or >> a >> remote pdf, or a local destination. Your code is obviously extracted from >> a >> program so it misses the context, so I don't quite understand. For >> example, >> what is the Matrix class stands for? In itext, I don't see any class with >> that name. And lastTextLineMatrix, what is it? Would you be so kind to >> tell >> me a bit more? I'm very grateful. > > > Probably the easiest thing to do is grep the itext source code, this > jumped > out pretty quickly to let me make my xytext utility. But yeah > I think the annotation part is documented. I think I ended up copying some > of the itext classes and changed a few methods, processor or something > like that. Again, if you have the text Readers has to figure out where > to put it so the information is in there. > >> >> >> >>>> >>>> What do these things return exactly? They seemed to follow >>>> x/y position in some documents anyway: >>> >>> Sorry, I cut/pasted the wrong text, this is probably the code you meant, >>> >>> public void displayText(String text, Matrix endingTextMatrix){ >>> boolean hardReturn = false; >>> if (lastTextLineMatrix != null && >>> lastTextLineMatrix.get(Matrix.I32) != >>> getCurrentTextLineMatrix().get(Matrix.I32)){ >>> hardReturn = true; >>> } >>> float currentX = getCurrentTextMatrix().get(Matrix.I31); >>> float sY = getCurrentTextMatrix().get(Matrix.I32); >>> String loc=""+((int)(currentX*100))+" "+((int)(sY*100))+" "; >>> >>> >>> >>>> [ this is my code but the context makes clear my quesiton- the >>>> values from PdfLiteral.getXXX() are what exactly ] >>>> >>>> public void dig(PdfLiteral d, PrintStream os) >>>> {oute(os,"lit: "+d.getPosition()+" "+d.getPosLength()+" >>>> "+d.toString()); } >>>> >>>> The reader needs to render the text so it needs to determine position >>>> etc. >>>> If the text exists as text in the source document you should be able >>>> to manipulate it ( with your own reflow algorithm...) >>>> >>>> >>>>> >>>>> So the initial answer still stands: it's not possible in general. >>>>> -- >>>>> This answer is provided by 1T3XT BVBA >>>>> http://www.1t3xt.com/ - http://www.1t3xt.info >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> This SF.net email is sponsored by: >>>>> High Quality Requirements in a Collaborative Environment. >>>>> Download a free trial of Rational Requirements Composer Now! >>>>> http://p.sf.net/sfu/www-ibm-com >>>>> _______________________________________________ >>>>> iText-questions mailing list >>>>> [email protected] >>>>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>>>> >>>>> Buy the iText book: http://www.1t3xt.com/docs/book.php >>>> >>>> _________________________________________________________________ >>>> Quick access to your favorite MSN content and Windows Live with >>>> Internet >>>> Explorer 8. >>>> http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0701A >>>> ------------------------------------------------------------------------------ >>>> This SF.net email is sponsored by: >>>> High Quality Requirements in a Collaborative Environment. >>>> Download a free trial of Rational Requirements Composer Now! >>>> http://p.sf.net/sfu/www-ibm-com >>>> _______________________________________________ >>>> iText-questions mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>>> >>>> Buy the iText book: http://www.1t3xt.com/docs/book.php >>> >>> _________________________________________________________________ >>> Rediscover HotmailĀ®: Get quick friend updates right in your inbox. >>> http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates1_042009 >>> ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by: >>> High Quality Requirements in a Collaborative Environment. >>> Download a free trial of Rational Requirements Composer Now! >>> http://p.sf.net/sfu/www-ibm-com >>> _______________________________________________ >>> iText-questions mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>> >>> Buy the iText book: http://www.1t3xt.com/docs/book.php >>> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> High Quality Requirements in a Collaborative Environment. >> Download a free trial of Rational Requirements Composer Now! >> http://p.sf.net/sfu/www-ibm-com >> _______________________________________________ >> iText-questions mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/itext-questions >> >> Buy the iText book: http://www.1t3xt.com/docs/book.php > > _________________________________________________________________ > Rediscover HotmailĀ®: Now available on your iPhone or BlackBerry > http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Mobile1_042009 > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
