i forgot about multiline selections ... since you dont want to draw rectangles above every single character but draw one or more continuous shapes, you have to combine the results you get from getTextRunInfo to draw as few shapes as possible (if you consider performance crucial).
have fun, filip On Thu, Jan 14, 2010 at 10:48 PM, filip sound <[email protected]> wrote: > hi, > > well, this has nothing to do with pdf2swf. many developers tried to use the > setSelection method but with decent results. text can be selected this way > but as soon as any transformation is applied, the selection is gone. i think > this is not intended to be used as a permanent selection. > > the only solution i know of is to use the TextSnapshot class to get the > position of the texts you want to have highlighted and draw a > semitransparent rectangle above it. > > has nothing to do with fonts either. > > look up TextSnapshot.findText and TextSnapshot.getTextRunInfo > > you need some skills in AS3 and maths since words are often split into many > single textfields internally - coming from the f*ckedup internal structure > of pdf files (or the programs that created the pdf file). it's getting > really intensive if the words you want to find are rotated - then every > single char is a separate static textfield. > > the getTextRunInfo method has two different types of return data - make > sure you handle both. > > if you need more info, just ask (i'm not going to post code somewhere) > the part for finding and selecting (drawing shapes above the words) has > about 130 lines of code in my project. > > good luck, > filip > > > > On Thu, Jan 14, 2010 at 8:29 PM, Denis Zgonjanin <[email protected]>wrote: > >> First of all, apologies since I know there have been a lot of posts on the >> mailing list about the text selection issues with pdf2swf, and I've read >> many posts on the archive but still have some unanswered questions. >> >> 1. Does anyone have an example of actually being able to select and >> highlight code with AS3/Flex and pdf2swf, specifically using the >> TextSnapshot.setSelected() method? >> >> 2. If I can get text using the TextSnapshot.getText() method, but I'm >> unable to select it with setSelected(), is this purely a fonts issue or are >> there other issues as well? >> >> 3. I'm converting slides with -f to include the fonts, and using -T9 to >> get AVM2 movie clips. Does this mean that ALL fonts get included, or just >> the ones present in the pdf? How does this affect the size of the pdf file? >> If all fonts are included, is there a way to find which fonts are in the >> file and only included those that are already in there in order to keep the >> slides small? >> >> If you can answer any of these questions, it would be extremly useful >> >> Thanks in advance, >> - Denis >> > >
