|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
org.faceless.pdf2.viewer2.feature.SignatureCapture
public class SignatureCapture
A feature which can be used to capture a handwritten signature on a Smartphone (iPhone, iPad or Android). It is disabled by default.
When run this feature starts an (extremely) simple webserver and then creates a QR-Code which can be scanned by the smartphone to access that server. On doing so the user is presented with a page with a signature box which they can "write" their signature into, using a finger or stylus. On completion the signature vector data is sent back to the webserver started by this process, and the server is shut down.
This requires that the computer running the viewer with this feature is accessible to the network the smartphone is on - in practice, this means they're on the same IP network with the smartphone connecting over WiFi. The URL for that computer will be guessed, but it can be specified if necessary with the "host" and "port" features.
This feature is normally used by the ManageIdentities
feature,
which will use this to capture the signature and store it in the KeyStore.
Doing so requires a
PKCS#11 or
JCEKS
KeyStore - if the the KeyStore is in the default JCE format, the user
will be prompted to upgrade it to JCEKS.
host | The fully qualified name of the host to use in the URL - specify this if the viewer can't derive it |
---|---|
port | The port to open the temporary server on - if not specified a random high port will be used
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
Field Summary | |
---|---|
static String |
KEYALGORITHM
The "algorithm" for the signature appearance KeyStore entry - they are stored as secret keys, which require an algorithm. |
static String |
PATHSUFFIX
The suffix recommended to be appended to a KeyStore alias for that entries signature appearance |
static char[] |
SECRETKEYPASSWORD
The password for the signature appearance KeyStore entry - they are stored as secret keys so must be password protected, although the information is not secret. |
Constructor Summary | |
---|---|
SignatureCapture()
|
Method Summary | |
---|---|
void |
action(ViewerEvent event)
|
static GeneralPath |
capture(InetSocketAddress address,
String submiturl,
int width,
int height)
Start a webserver, display a QR-Code that can be scanned to access it, and capture the signature entered on that webpage as a GeneralPath. |
GeneralPath |
capture(int width,
int height)
|
static JComponent |
getPathComponent(GeneralPath path)
A convenience method which will return a JComponent that displays the specified GeneralPath |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer |
boolean |
isEnabledByDefault()
Return true if this feature is enabled by default (the default). |
static GeneralPath |
readPath(byte[] data)
A convenience method which will deserialize the specified GeneralPath into a byte array. |
void |
setLocalAddress(InetSocketAddress address)
Set the local address to open the webserver on. |
static byte[] |
writePath(GeneralPath path)
A convenience method which will serialize the specified GeneralPath into a byte array. |
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
---|
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, setFeatureName, teardown, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PATHSUFFIX
public static final String KEYALGORITHM
public static final char[] SECRETKEYPASSWORD
Constructor Detail |
---|
public SignatureCapture()
Method Detail |
---|
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class ViewerFeature
public boolean isEnabledByDefault()
ViewerFeature
ViewerFeature.getAllEnabledFeatures()
and by the PDFViewerApplet
and PDFTool
isEnabledByDefault
in class ViewerFeature
public void setLocalAddress(InetSocketAddress address)
public static byte[] writePath(GeneralPath path)
readPath(byte[])
public static GeneralPath readPath(byte[] data)
writePath(java.awt.geom.GeneralPath)
public static JComponent getPathComponent(GeneralPath path)
GeneralPath
public void action(ViewerEvent event)
public GeneralPath capture(int width, int height)
public static GeneralPath capture(InetSocketAddress address, String submiturl, int width, int height)
address
- the local address of the webserver - the port may be null - or null to use the default for this feature.submiturl
- if not null, the URL that the signature should be submitted towidth
- the width of the desired "signature strip". Will be scaled to fit the device screenheight
- the height of the desired "signature strip".
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |