Search for QR Code standard entries

GroupDocs.Signature provides ability to embed into QR-code signature standard entries like email, contact v-card, address etc, WiFi, contact MeCard. This feature supports standard QR-code representation of entries. At this moment following standard QR-code entries are supported

  • Email entry that allows to specify in QR-code standard email information with recipient, subject and body.
  • Address entry contains address information.
  • V-Card entry implements standard of visit card 3.0 specification. More details could be found here.
  • Me-Card entry implements similar to V-Card contact details standard. More details could be found here.
  • EPC implements standard of the European Payments Council guidelines define the content of a QR code that can be used to initiate SEPA credit transfer. More details could be found here.
  • Event entry implements event standard.
  • WiFi entry implements WiFi settings standard.
  • SMS entry implements sms properties.
  • CryptoCurrencyTransfer entry implements cryptocurrency transfer details.

Here are the steps to extract standard entry from the QR-code signature with GroupDocs.Signature:

  • Create new instance of Signature class and pass source document path as a constructor parameter.
  • Call the search method of Signature with the QrCodeSignature class and pass SignatureType.QrCode to it.
  • Enumerate the response with the list of the QrCodeSignature signatures and call the getData method with the entry class, for example getData(Address.class), to retrieve the required instance of the object. Check the result for null before using it.
Note
The evaluation version recognizes QR-codes with restrictions and does not return their full text, so getData cannot restore the entry objects. Apply a license to run these examples, see Evaluation Limitations and Licensing.

Example 1: How to get Address QR Code object in the document

Following example shows how to search for QR-code Address object in the PDF document.

Signature signature = new Signature("sample.pdf");
try
{
    List<QrCodeSignature> signatures = signature.search(QrCodeSignature.class, SignatureType.QrCode);
    for (QrCodeSignature qrSignature : signatures)
    {
        Address address = qrSignature.getData(Address.class);
        if (address != null)
        {
            System.out.println("Found Address: " + address.getCountry() + " " + address.getState() + " " + address.getCity() + " " + address.getZIP());
        }
    }
}
finally
{
    signature.dispose();
}

Example 2: How to get Email QR Code object in the document

Following example shows how to search for QR-code Email object in the PDF document.

Signature signature = new Signature("sample.pdf");
try
{
    List<QrCodeSignature> signatures = signature.search(QrCodeSignature.class, SignatureType.QrCode);
    for (QrCodeSignature qrSignature : signatures)
    {
        Email email = qrSignature.getData(Email.class);
        if (email != null)
        {
            System.out.println("Found Email signature: " + email.getAddress() + ": [" + email.getSubject() + "] : " + email.getBody());
        }
    }
}
finally
{
    signature.dispose();
}

Example 3: How to retrieve VCard QR Code object from image or document

Following example shows how to retrieve contact VCard object from the QR Code signature.

Signature signature = new Signature("sample.pdf");
try
{
    List<QrCodeSignature> signatures = signature.search(QrCodeSignature.class, SignatureType.QrCode);
    for (QrCodeSignature qrSignature : signatures)
    {
        VCard vcard = qrSignature.getData(VCard.class);
        if (vcard != null)
        {
            System.out.println("Found VCard signature: " + vcard.getFirstName() + " " + vcard.getLastName() + " from " + vcard.getCompany() + ". Tel: " + vcard.getCellPhone());
        }
    }
}
finally
{
    signature.dispose();
}

Example 4: How to find the EPC data in the QR Code from image or document

Following example shows to find the EPC (The European Payments Council Quick Response Code) data in the QR Code from image or document.

Signature signature = new Signature("sample.pdf");
try
{
    List<QrCodeSignature> signatures = signature.search(QrCodeSignature.class, SignatureType.QrCode);
    for (QrCodeSignature qrSignature : signatures)
    {
        EPC payment = qrSignature.getData(EPC.class);
        if (payment != null)
        {
            System.out.println("EPC: " + payment.getName() + ", IBAN " + payment.getIBAN() + ". Amount " + payment.getAmount() + ". Ref: " + payment.getReference() + " / " + payment.getRemittance());
        }
    }
}
finally
{
    signature.dispose();
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured Java library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.