This addon provides additional features to Alfresco Content Service.
It can be used standalone or included in beCPG PLM.
beCPG is an open source Product Lifecycle Management (PLM) software designed to manage food, cosmetics and CPG products. It helps to accelerate innovation and reduce time-to-market while improving product quality. https://www.becpg.fr/
Annotation feature is provided with two implementations:
- Standalone using PDFTron proprietary library, providing actions upon PDF document :
(To use pdftron you have to download it and place it to /becpg-artworks-share/src/mains/assembly/web/components/artworks-viewer/pdftron/ See Install instructions in pdftron folder)
* Or external using Kami annotation manager
Enables comparison button in document version view
This enables image and PDF comparison between 2 versions of a document.
PDF text and image comparison feature are also provided with standalone PDFTron Viewer
Digital signature is provided internally using PDFTron Library and PDFBox or externally using Docusign:
-
wait for the recipients to sign the document (you will receive an email when it's done)
For details on how to use internal signatures refers to API
- Alfresco 7
This project uses Alfresco SDK 4.2. Refers to Alfresco SDK documentation to see how-to build and run project
-
Download the two AMPs provided by the becpg-artworks release
-
Install the two AMPs into your content service by running
java -jar /root/alfresco-mmt.jar install /root/amp/ webapps/alfresco -nobackup -directory -force
For internal digital signature you have to install additional certificate in alfresco keystore:
Digital signature use the alfresco encryption.keystore.location to store is certificate.
To install existing pkcs12 certificates into default alfresco keystore use the following commands:
keytool -importkeystore \
-deststorepass mp6yc0UD9e -destkeypass oKIWzVdEdA -destkeystore /usr/local/tomcat/shared/classes/alfresco/extension/keystore \
-srckeystore my-cert.p12 -srcstoretype PKCS12 -deststoretype JCEKS -srcstorepass [p12-cert-password] \
-alias [some-alias]
To create a new certificate for test purpose:
keytool -genkeypair -alias [some-alias] -validity 365 -keyalg RSA -keysize 2048 -keypass oKIWzVdEdA -storetype JCEKS -keystore /usr/local/tomcat/shared/classes/alfresco/extension/keystore/keystore -storepass mp6yc0UD9e
Enable DocuSign signature by providing API access token:
beCPG.signatureAuthorization=accountId;access_token
Enable Kami external PDF annotation by providing API access token:
beCPG.annotationAuthorization=token
Enable PDFTron internal PDF annotation by proving licence key:
beCPG.annotationViewerLicenseKey=licenceKey
Enable internal digital signature with PDFBox (PDFTron annotation viewer is required)
beCPG.signature.reasonInfo=Digitally signed with beCPG
beCPG.signature.tsaUrl=https://freetsa.org/tsr
beCPG.signature.keystore.alias=[some-alias]
beCPG.signature.keystore.password=[some-password]
To configure signature certificate use the new way of specifying the configuration in JVM system properties (Don't store password on properties files) :
JAVA_TOOL_OPTIONS: "
-DbeCPG.signature.keystore.alias=[some-alias]
-DbeCPG.signature.keystore.password=[some-password]
"
Note: If left empty or not provided, features are not enabled.
Internal signature support is best integrated with beCPG PLM. If you want to use it out of box beCPG provides several JavaScript Helpers.
beCPG Arworks expose some JavaScript API function in order to use digital signature under the bSign root object
Method | Description |
---|---|
prepareForSignature(document, recipients, params) | document is the ScriptNode of the PDF document you want to sign, recipients is an array of ScriptNode representing the current recipients for whom the document will be prepared, params is an optional parameter which is an array of strings, the values change the signature positioning, size, and string anchors for the signature |
signDocument(document) | Digitally sign the document for the prepared recipients |
getSignatureView(document, userName, task) | Returns the signature viewer URL (must be prefixed with HOST:PORT/share/page/context/mine/) |
Parameters :
The signature feature is designed so that each page of the document will contain a signature field, either a "final signature" field, or a "initials" signature. You can define in which page you want to see the final signature, among other things.
The params of the prepareForSignature method have default values if nothing is set. Here is the default params structure :
bSign.prepareForSignature(document, recipients, "last", "100,50,3,60,75,10", "signature,2,0", "50,25,3,30,75,10", "Page,0,2")
- last : defines the page number of the final signature. It can be a number ("1", "14", ...) or a number from the end ("last", "last-2", ...)
- 100,50,1,150,300,300 : defines the signature field dimensions (width,height,direction(1=right,2=left,3=up,4=down),gap,fromLeftProportion,fromBottomProportion). Direction is the direction of the multiple fields on each page (if there are multiple recipients). The margins are here to positionate the first field in case of a non-matching keyword
- signature,2,0 : defines the signature field anchor information (keyWord,xposition(0=left,1=middle,2=right),yposition(0=bottom,1=middle,2=top))
- "50,25,3,30,150,150" : defines the initials field dimensions (width,height,direction(1=right,2=left,3=up,4=down),gap,fromLeftProportion,fromBottomProportion)
- Page,0,2 : defines the initials field anchor information (keyWord,xposition(0=left,1=middle,2=right),yposition(0=bottom,1=middle,2=top))
You can call the beCPG Signature API inside your scripts. Here is a example of workflow using scripts :
1. Upload a PDF document to ACS
2. Add the signature aspect to it, with some "sign:recipients" associations which are the recipients (alfresco accounts)
3. Call the "prepareForSignature" method bSign.prepareForSignature(document, recipients, params)
Note that the chosen recipients must belong to the recipients defined earlier. The signature preparation can be done for each recipient or for all recipients at once, depending on your process
4. Call the "getSignatureView" method bSign.getSignatureView(document, null, null)
which will return a URL (it must be prefixed with "HOST:PORT/share/page/context/mine/")
5. Once you enter the viewer, you can see the annotations that need to be signed. Please sign all the annotations before Saving the document
6. Once the document is saved with the viewer, you need to complete the signature by calling the method "signDocument"
bSign.signDocument(document)
which will digitally sign the document for the prepared recipients
Example :
var document = search.findNode("workspace://SpacesStore/38a2e156-73c0-47d9-8efd-24c84782c084");
var recipient1 = search.findNode("workspace://SpacesStore/16c4ef69-aab4-4017-9d84-d3e1b526086f");
var recipient2 = search.findNode("workspace://SpacesStore/b4273aa7-b66c-4cfe-81c0-02f95a26d7af");
// create the recipients associations
document.createAssociation(recipient1, "sign:recipients");
document.createAssociation(recipient2, "sign:recipients");
// prepare signature of recipient1
var preparedRecipient = [];
preparedRecipient.push(recipient1);
bSign.prepareForSignature(document, preparedRecipient);
// get the signature view for recipient1
var url = bSign.getSignatureView(document,null,null);
Here the recipient1 must sign the document with the viewer and save it.
// after recipient1 signed the document with the viewer : sign the document digitally for recipient1
bSign.signDocument(document);
// prepare signature of recipient2
var preparedRecipient = [];
preparedRecipient.push(recipient2);
bSign.prepareForSignature(document, preparedRecipient);
// get the signature view for recipient2
var url = bSign.getSignatureView(document,null,null);
Here the recipient2 must sign the document with the viewer and save it.
// after recipient2 signed the document with the viewer : sign the document digitally for recipient2
bSign.signDocument(document);