PDF validation
Validating PDFs
SWF can validate PDF's when they are uploaded to give users either a warning or refuse documents, depending on the configuration. To enable the validation functionality, set this is the root of your config.json
file:
"signingOrders": {
"disableDocumentChecks": false
}
This is also the default configuration so if you want to disable PDF validation, simply set disableDocumentChecks
to true
. When it is enabled, SWF will look for three kinds of properties in your documents:
- Locks
- Previously added signatures
- Signing page
Locks
PDFs can have different kinds of locks and SWF will, by default, check for known locks in the documents you upload. If a known lock is found and the PDF lock validation functionality is enabled, the PDF is refused and the user can not create an errand with that PDF. To continue with that document, remove the lock and upload again.
Administrators can also disable this functionality by setting signingOrders.disableDocumentChecks
to true
.
To decide what message should be shown if a lock is detected, update the following attribute in the strings.json
file:
{
"form": {
"FileUploader": {
"error": {
"locked": "This will be shown if the PDF is locked."
}
}
}
}
If a locked PDF is uploaded and lock check is disabled, users might not be able to sign the document
Previously added signatures
This functionality will also check for previously added signatures. If any previously added signatures are found, a warning will be shown to the user to warn about moving forward with this particular document. The reason for this is that a small number of documents may contain issues, such as problems with certificate validation or implementation, that could prevent you from successfully signing the document. While this is uncommon, it can occasionally occur. However, the user can still decide to continue with the document since it is only a warning.
The property to control the warning messages can be found in the strings.json
file:
{
"form": {
"FileUploader": {
"error": {
"signed": "This will be shown if the PDF is already signed."
}
}
}
}
Controlling warnings
If the warnings from the PDF format validation is seen as severe, administrators can choose to reject PDFs that generate warnings. To do this, we can use the following configuration, in the config.json
:
"signingOrders": {
"rejectInvalidPdfA": true
}
The rejectInvalidPdfA
default to false
.
Validating PDF flavours
The application can be configured to validate PDF/A conformance validation on PDF files, when a signing order is created. The purpose of this function is to warn the user if the uploaded file does not meet the standards required by organisation policy.
Configure the system by indicating what PDF/A flavours are allowed. If NO_FLAVOUR is configured, all PDF/A flavours will be accepted. If no flavour at all is configured, the validation is skipped.
Tag | Description |
---|---|
NO_FLAVOUR | All PDF/A flavours |
PDFA_1_A | 1a PDF Version 1 Level A |
PDFA_1_B | 1a PDF Version 1 Level B |
PDFA_2_A | 2a PDF Version 2 Level A |
PDFA_2_B | 2b PDF Version 2 Level B |
PDFA_2_U | 2u PDF Version 2 Level U |
PDFA_3_A | 3a PDF Version 3 Level A |
PDFA_3_B | 3b PDF Version 3 Level B |
PDFA_3_U | 3u PDF Version 3 Level U |
PDFA_4 | 4 PDF Version 4 |
PDFA_4_F | 4 PDF Version 4 Level F |
PDFA_4_E | 4 PDF Version 4 Level E |
PDFUA_1 | ua1 PDF Version 1 |
WCAG2_1 | wcag PDF version 2.1 |
Example configuration to allow 1a PDF Version 1 Level A
and 3a PDF Version 3 Level A
"usePdfAFlavours": ["PDFA_1_A", "PDFA_3_A"]
To control the message shown to the user, use any of the following properties, found in the strings.json
file:
{
"form": {
"FileUploader": {
"error": {
"format": "The file has incorrect format",
"signed": "The file has already been signed",
"locked": "The file is locked",
"notPdf": "The file is not a PDF",
"unsupported": "The file type is unsupported"
}
}
}
}
The default behavior to warn the user can be changed to reject the invalid PDF and not allow the order to be created at all. This will disable the "Create" button in the final step and also present a red warning text if the PDF standard is not met.
To activate the function, add "rejectInvalidPdfA": true
to the signingOrders
section of the config.json.