> I am looking for a python based utility that will allow a user to sign
> their name with a mouse and save the resulting image for inclusion in
> a PDF. Has anyone heard of something like this?

Well, you're asking a python question on the Django list.

Unless you're trying to do this in a Django web-app.

Last I tried this, I had to use a custom web control (whether
Java, ActiveX, Flash, etc...my code went to my former employer,
but it's not hard to recreate).  It might be possible to do with
some snazzy javascript to capture mouse-down/up/move events in a
<div>.  The basic algorithm is easy:

on mouse down: stroke = list containing mouse x/y, set "drawing" flag

on mouse move: if "drawing" flag is set, append mouse x/y to the
stroke list, and draw a line from stroke[-1] to x/y [*]

on mouse up: you now have a full stroke.  Add the stroke to a
list of strokes in the signature

When they click "done", you have a list of the strokes comprising
their signature.  This can be rendered at any resolution you
want, as you can easily find the min/max for the x/y values, and
then scale the resulting signature into your target box.  Most
PDF toolkits allow you to render lines, so you just scale your
list of strokes to that box.

I've seen folks try to use a bitmap version of things rather than
a vector version, but when you print it, it ends up looking
horrible because you're shifting from a 72-106dpi device to a
120-1200dpi device which involves some ugly bitmap magnification.

If it's a pure python app, the same algorithm holds...you just
have to do it in whatever toolkit you're using, rather than a
JS/Java/Flash/ActiveX control.

Also, signing with a true mouse is almost impossible.  A 1::1
device is far better, whether a tablet, or a touch-screen, or
(what I used) a PDA stylus screen.

-tim
[*] if this is purely for printing, this is fine.  A colleague in
college wrote a paper on hand-writing analysis algorithms which
also flagged the timestamp of each mouse[up/down/move] event
which tracked the velocity which is much harder to forge if this
is for legal reasons of "Person X signed this document"



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to