Installation:
- copy the files from the "dist" folder into your application
- add SignaturePad.jar to your BBj Classpath
- add SignaturePad.bbj to your PREFIX
- look at Sample.bbj to learn about
use ::SignaturePad.bbj::SignaturePad
path$="d:/github/signaturepad/dist/"
file$=path$+"sample.json"
png$ = SignaturePad.getSignatureAsPng(file$)
ch=unt
OPEN (CH,mode="O_TRUNC,O_CREATE")path$+"sig_thin.png"
print(ch) png$
close (ch)
png$ = SignaturePad.getSignatureAsPng(file$,3)
ch=unt
OPEN (CH,mode="O_TRUNC,O_CREATE")path$+"sig_thick.png"
print(ch) png$
close (ch)
release
Make sure to add the license credits with your BBj app.
Credits belong to:
Builds images from common customer signature serialization formats
- Points, big-endian
- Points, little-endian
- 3-byte ASCII
- Vector text
Requires JDK 1.7 or greater
john-hancock
is available as a Maven artifact from Maven Central.
compile 'net.seabears:john-hancock:1.0.1'
<dependency>
<groupId>net.seabears</groupId>
<artifactId>john-hancock</artifactId>
<version>1.0.1</version>
</dependency>
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.seabears.signature.Converter;
import net.seabears.signature.Format;
public class Main {
static class Signature {
public byte[] data;
}
public static void main(final String[] args) throws IOException {
final String json = "{\"data\":\"/////wAAAAAAAAAUAAoAFP////8AAAAAAAoAAP////8AAAAKAAcACv//" +
"//8AFAAAABQAFP////8AFAAAAB4AAAAeAAoAFAAK/////wAyAAAAKAAAACgACgAyAAoAMgAUACgAFP//" +
"//8AUAAAAFAAFP////8AWgAAAFoAFP////8AUAACAFoAEv////8AZAAAAGQAFABuABQAbgAA/////wB4" +
"AAAAeAAUAIIAFP////8AjAAAAIwAFACWABT/////\"}";
final Signature signature = new ObjectMapper().readValue(json, Signature.class);
final Converter converter = new Converter();
final RenderedImage image = converter.convert(signature.data, Format.POINTS_BIG_ENDIAN);
ImageIO.write(image, "png", new File("example.png"));
}
}
Converter accepts a Config instance. This allows you to configure
- background color
- foreground color
- padding
Copyright © 2017 Corey Beres
Distributed under the MIT license