For everyone else make sure you follow these steps:
1. Use Flash 8 or previous version (I used 6) with the -T command : pdf2swf -T 6
2. Use the -f command for full fonts : pdf2swf -f
3. Test your outputted swf with: swfdump -t filename.swf , you should see a
list of DEFINETEXT statements and the corresponding text. Due to a font
conflict I was seeing DEFINETEXT followed by jumbled up text on my first pdf.
4. Test your outputted swf with: swfstrings filename.swf, you should see your
text and a LOT of ???????s. Again, I had garbage text when trying to convert my
original PDF.
If the swfdump and swfstrings tests are working, load your pdf2swf.swf into
Flash. Publish it for 8.
I loaded it into a movieclip on my root timeline called 'loader' :
loader.loadMovie("pdf2swf_files/6new.swf");
I have a movieclip called 'searchText_mc' and have the following code for it:
searchText_mc.onRelease = function() {
hltext ("wonderful");
}
And then the hltext is as Fabio provided. This will yellow-highlight all the
occurrences of the search string:
function hltext ( txt )
{
trace("hltext");
var mc = _root.loader;
var my_snap:TextSnapshot = mc.getTextSnapshot();
var start_pos:Number = 0;
start_pos = my_snap.findText ( start_pos, txt, false );
trace("start_pos : " + start_pos);
while ( start_pos > 0 )
{
trace ( start_pos );
my_snap.setSelected( start_pos, start_pos + txt.length,
true );
start_pos += txt.length;
start_pos = my_snap.findText ( start_pos, txt, false );
}
}
If anyone would like some sample files give me a shout,