that said, here there is my ActionScript code to highlight the text
inside a PDF page. It works with Flash 8 or previous ONLY because the
new Flash 9 has a different AVM interpreter (AVM2) and many things have
changed.
Please note:
- ``txt`` is the text to search and highlight inside your page
- ``mc`` points to _root.text that's where I was keeping my swf/pdf page
you should change that so it references yours.
Here is the code:
function hltext ( txt )
{
var mc = _root.text;
var my_snap:TextSnapshot = mc.getTextSnapshot();
var start_pos:Number = 0;
start_pos = my_snap.findText ( start_pos, txt, false );
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 );
}
}
Re: [Swftools-common] PDF2SWF and getTextSnapShot() - 0 views
-
that said, here there is my ActionScript code to highlight the text inside a PDF page. It works with Flash 8 or previous ONLY because the new Flash 9 has a different AVM interpreter (AVM2) and many things have changed. Please note: - ``txt`` is the text to search and highlight inside your page - ``mc`` points to _root.text that's where I was keeping my swf/pdf page you should change that so it references yours. Here is the code: function hltext ( txt ) { var mc = _root.text; var my_snap:TextSnapshot = mc.getTextSnapshot(); var start_pos:Number = 0; start_pos = my_snap.findText ( start_pos, txt, false ); 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 ); } }
A tour of git: the basics - 0 views
-
~ suffix
-
HEAD~
-
HEAD~2" refers to two commits back
- ...19 more annotations...
FUMSI - Data Visualisation: Tools and Examples - 0 views
-
The online visualisation of data continues to stretch in many directions with great effectiveness. Inspired by seminal influences, such as Edward Tufte, there's an ever growing stream of online and offline tools, projects, research and resources for visualising, interpreting and researching ultimately any type of data, for a vast range of uses.
Working with models, part 2 - 0 views
-
Every Django model class and every instance of every Django model class has an attribute on it named _meta
Django Tagging - 0 views
-
>>> tags = Tag.objects.usage_for_model(Widget, counts=True)
-
[('cheese', 1), ('house', 2), ('thing', 1), ('toast', 1)]
-
def usage_for_model(self, model, counts=False, min_count=None, filters=None): """ Obtain a list of tags associated with instances of the given Model class. If ``counts`` is True, a ``count`` attribute will be added to each tag, indicating how many times it has been used against the Model class in question. If ``min_count`` is given, only tags which have a ``count`` greater than or equal to ``min_count`` will be returned. Passing a value for ``min_count`` implies ``counts=True``. To limit the tags (and counts, if specified) returned to those used by a subset of the Model's instances, pass a dictionary of field lookups to be applied to the given Model as the ``filters`` argument. """ if filters is None: filters = {} if min_count is not None: counts = True model_table = qn(model._meta.db_table) model_pk = '%s.%s' % (model_table, qn(model._meta.pk.column)) query = """ SELECT DISTINCT %(tag)s.id, %(tag)s.name%(count_sql)s FROM %(tag)s INNER JOIN %(tagged_item)s ON %(tag)s.id = %(tagged_item)s.tag_id INNER JOIN %(model)s ON %(tagged_item)s.object_id = %(model_pk)s %%s WHERE %(tagged_item)s.content_type_id = %(content_type_id)s %%s GROUP BY %(tag)s.id, %(tag)s.name %%s ORDER BY %(tag)s.name ASC""" % { 'tag': qn(self.model._meta.db_table), 'count_sql': counts and (', COUNT(%s)' % model_pk) or '', 'tagged_item': qn(self._get_related_model_by_accessor('items')._meta.db_table), 'model': model_table, 'model_pk': model_pk, 'content_type_id': ContentType.objects.get_for_model(model).pk, } extra_joins = '' extra_criteria = '' min_count_sql
-
usage_for_model
1 - 6 of 6
Showing 20▼ items per page