Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Created February 22, 2021 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/31c41589bda73b4310db679300628cb2 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/31c41589bda73b4310db679300628cb2 to your computer and use it in GitHub Desktop.
Add QR Code to PDF, Excel, PPT, Word Documents, and Images in Java
// Change Appearance of QR code in Java
// Setting background color, forecolor, transparency, etc.
Background background = new Background();
background.setColor(Color.BLACK);
background.setTransparency(0.5);
options.setBackground(background);
options.setForeColor(Color.WHITE);
// Electronically Sign PDF, Excel, PPT, Word Documents and Images with QR Code using GroupDocs.Signature for Java API
Signature signature = new Signature("filePath/document.pdf"); // Provide any DOC, PDF, XLS, PPT, PNG, JPG, WebP file.
// Create QR Code option with predefined text
QrCodeSignOptions options = new QrCodeSignOptions("Signed by GroupDocs");
options.setEncodeType(QrCodeTypes.QR);
options.setAllPages(true);
// Set QR Code position & appearance
options.setLeft(50);
options.setTop(50);
options.setHeight(90);
options.setWidth(90);
// Sign document and save file
signature.sign("filePath/document-with-qr-code.pdf", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment