Skip to main content
All CollectionsSystem TasksWorking with Groovy ScriptsGroovy Script Library
Groovy Script - Embed QR code (of 'Static' type) while downloading and printing the document (Supported in Asite Viewer supported file formats only)
Groovy Script - Embed QR code (of 'Static' type) while downloading and printing the document (Supported in Asite Viewer supported file formats only)
Updated over a week ago

Description: Sample groovy script to embed QR code (of 'Static' type) while downloading & printing the document (Supported in Asite Viewer supported file formats only)

Click here for detailed help.

Context: Document

Remark: Accessible in 'Pre' task mode only

Script:

def execute(){

DocumentVO document = documentService.getDocumentDetails();

boolean success = false;

boolean isNonPDF = !document.getFileName().endsWith(".pdf") && !document.getFileName().endsWith(".PDF");

if ((isNonPDF || QRCodeTypes.ISO.getId() == documentService.getWorkspaceQRCodeType(document))

&& documentService.isQRCodeEnabled(document, IGroovyConstant.FOLDER_LEVEL)) {

success = documentService.applyQRCode(document);

if (success) {

document.setExecutionStatus(Status.SUCCESS);

document.setResponseMessage("QR CODE EMBEDED SUCCESSFULLY");

} else {

document.setExecutionStatus(Status.FAILED);

document.setResponseMessage("QR CODE EMBED FAILED");

}

} else {

document.setExecutionStatus(Status.NOT_REQUIRED);

document.setResponseMessage("QR CODE NOT_REQUIRED");

}

document.setResponseStatus(false);

return document;

}



Did this answer your question?