GroupDocs.Signature for Java

Create QR codes for PDF

Easily create 2D barcodes with text and numeric data and place them on any page of various documents using GroupDocs.Signature for Java.

Steps to generate and place a QR code at any location in a PDF

GroupDocs.Signature can generate QR codes in many popular formats and place them on PDF pages. Over 10 QR code types are supported and can be quickly integrated into Java applications. Use our product to sign documents with generated QR codes.

  1. Get the PDF file or stream to be signed with a QR code.
  2. Provide the text for QrCodeSignOptions.
  3. Customize visual options such as color, position, size, etc.
  4. Save the file with the QR code.
// Pass the document to a new Signature instance
Signature signature = new Signature("input.pdf");

// Use QrCodeSignOptions to add a QR code to the document
QrCodeSignOptions options = new QrCodeSignOptions("Text Content");

// Specify the signature type and position on the page
options.setEncodeType(QrCodeTypes.QR);
options.setLeft(50);
options.setTop(150);

// Save the file with the added QR code
signature.sign("output.pdf", options);
Maven XML
click to copy
copied
More examples Documentation

Add signatures to your documents

The GroupDocs.Signature for Java API supports signing all popular file formats. Generate, modify, search, verify, and delete different types of signatures.

Key Features of GroupDocs.Signature

Sign documents

GroupDocs.Signature supports signing with Text, Image, Barcode, QR Code, and Stamp signatures. Place them on any page of any supported document format. Manage document metadata with metadata signatures, and protect the content from unauthorized changes using digital certificates.

Search and verification

Ensure that all signatures in a document are valid with the verification procedure. Retrieve a complete list of signatures in a document using the built-in search feature.

Modify signatures

Easily modify signature properties after signing. Adjust content, position, color, size, and other attributes as needed.

Remove signatures

Delete unwanted signatures with ease. Various signature types, including digital certificates, can be programmatically removed from documents.

How to customize a generated QR code

Use this example to learn how to place a new QR code on a PDF page.

Java

// Get the document that needs to be signed and pass it to Signature
Signature signature = new Signature("input.pdf");

// Use QR code options to provide text with the required information
QrCodeSignOptions signOptions = new QrCodeSignOptions("Archived on July 11, 2019");

// Set the relative position of the QR code on the page
signOptions.setVerticalAlignment(VerticalAlignment.Top);
signOptions.setHorizontalAlignment(HorizontalAlignment.Right);

// Set the signature padding
Padding padding = new Padding();
padding.setRight(20);
padding.setTop(20);
signOptions.setMargin(padding);

// Specify the color of the QR code
signOptions.setForeColor(Color.RED);

// Define the font options for the message
SignatureFont font = new SignatureFont();
font.setSize(12);
font.setFamilyName("Comic Sans MS");
signOptions.setFont(font);

// Customize the QR code background color and brush
Background background = new Background();
background.setColor(Color.GREEN);
background.setTransparency(0.5);
background.setBrush(new LinearGradientBrush(Color.GREEN, Color.DARK_GRAY, 0));
signOptions.setBackground(background);

// Add the QR code to the document
SignResult signResult = signature.sign("output.pdf", signOptions);
Maven XML
click to copy
copied
More examples Documentation

Learn more about GroupDocs.Signature for Java

GroupDocs.Signature for Java offers a wide range of features to generate and embed various types of signatures in all major document formats. It supports PDFs, Word documents, Excel spreadsheets, PowerPoint presentations, and images. Enhance your documents with Text, Image, Barcode, QR Code, Metadata, Digital, and Stamp signatures.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Signature for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Check out our key offerings

We offer a diverse selection of signature features and advanced operations

Generate QR codes for additional file formats

Enhance all popular file formats with generated QR codes using the Java API. Add 2D barcode data for easy scanning and processing.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English