Skip to main content

Groovy Script - Embed QR code (of 'Dynamic' type) when Downloading and Printing the Document

Updated over 2 months ago

Description: Sample Groovy script to embed QR code (of 'Dynamic' type) when downloading & printing the document (Supported in Asite Viewer-supported file formats only).

Click here to learn more.

Context: Document

Remark: Accessible in 'Pre' task mode only.

Script:

def execute(){

DocumentVO document = documentService.getDocumentDetails();

boolean success = false;

if ((!document.getFileName().endsWith(".pdf") && !document.getFileName().endsWith(".PDF")) && documentService.isQRCodeEnabled(document, IGroovyConstant.FOLDER_LEVEL)) {

if(documentService.applyQRCode(document)) document.setExecutionStatus(Status.SUCCESS);

else document.setExecutionStatus(Status.FAILED);

} else {

document.setExecutionStatus(Status.NOT_REQUIRED);

}

document.setResponseStatus(false);

return document;

}



Did this answer your question?