Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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