Hi Filip,

Thanks for the answers. I did try drawing shapes around the individual
characters, but have another problem. getTextRun() returns to me the x and y
position of the character, but height is returned as a decimal between 0 and
1, which is odd because height is supposed to be in pixels. Also parameters
corner0x, corner0y, corner1x, corner1y, etc... are not there at all. The
documentation for getTextRun says that these will only be available if the
font is embedded in the SWF file. When I convert the file with pdf2swf I
include my entire fonts directory, yet even with simple fonts I don't seem
to be able to get these parameters. Do I have to explicitelly embed that
font in AS3 as well? If so, how do I know which fonts are in the pdf
originally?

Thanks,
- Denis

On Thu, Jan 14, 2010 at 4:53 PM, filip sound <[email protected]> wrote:

> 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
>>>
>>
>>
>

Reply via email to