Sign documents with standard QR Code entries

GroupDocs.Signature provides ability to embed into QR-code signature standard entries like email, contact v-card, address etc. 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.
  • CryptoCurrencyTransfer entry implements event standard.
  • WiFi entry implements WiFI settings standard.
  • SMS entry implements sms properties.

Here are the steps to embed standard entry into QR-code with GroupDocs.Signature:

  • Create new instance of  Signature class and pass source document path as a constructor parameter.
  • Create new instance of one of standard entries class.
  • Create one or several objects of QrCodeSignOptions object with Data value assigned with initialized standard object before.
  • Instantiate the  QrCodeSignOptions  object according to your requirements and custom object to Data property.
  • Call Sign method of  Signature  class instance and pass QrCodeSignOptions to it.

Sign PDF with email QR-code object

This example shows how to esign PDF with Email QR-code object.

using (Signature signature = new Signature("sample.pdf"))
{
    // create Email object
    var email = new Email()
    {
        Address = "sherlock@holmes.com",
        Subject = "Very important e-mail",
        Body = "Hello, Watson. Reach me ASAP!"
    };

    // create options
    var options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = email,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };

    // sign document to file
    signature.Sign("output.pdf", options);
}

Sign PDF with Address inside the QR-Code image

This example shows how to esign PDF with address inside the QR-code image.

using (Signature signature = new Signature("sample.pdf"))
{
    // create Address object
    var address = new Address()
    {
        Street = "221B Baker Street",
        City = "London",
        State = "NW",
        ZIP = "NW16XE",
        Country = "England"
    };
    // create options
    var options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = address,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Margin = new Padding(10),
        Width = 100,
        Height = 100,
    };
    // sign document to file
    signature.Sign("output.pdf", options);
}

Sign PDF with V-Card (VCF) information in the QR-Code image

This example shows how to esign PDF with V-Card inside the QR-code image.

using (Signature signature = new Signature("sample.pdf"))
{
    // create VCard object
    var vCard = new VCard()
    {
        FirstName = "Sherlock",
        MidddleName = "Jay",
        LastName = "Holmes",
        Initials = "Mr.",
        Company = "Watson Inc.",
        JobTitle = "Detective",
        HomePhone = "0333 003 3577",
        WorkPhone = "0333 003 3512",
        Email = "watson@sherlockholmes.com",
        Url = "http://sherlockholmes.com/",
        BirthDay = new DateTime(1854, 1, 6),
        HomeAddress = new Address()
        {
            Street = "221B Baker Street",
            City = "London",
            State = "NW",
            ZIP = "NW16XE",
            Country = "England"
        }
    };
    // create options
    var options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = vCard,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };

    // sign document to file
    signature.Sign("output.pdf", options);
}

Sign PDF with Me-Card information in the QR-Code image

This example shows how to esign PDF with Me-Card inside the QR-code image.

using (Signature signature = new Signature("sample.pdf"))
{
    // create MeCard object
    MeCard card = new MeCard()
    {
        Name = "Sherlock",
        Nickname = "Jay",
        Reading = "Holmes",
        Note = "Base Detective",
        Phone = "0333 003 3577",
        AltPhone = "0333 003 3512",
        Email = "watson@sherlockholmes.com",
        Url = "http://sherlockholmes.com/",
        BirthDay = new DateTime(1854, 1, 6),
        Address = new Address()
        {
            Street = "221B Baker Street",
            City = "London",
            State = "NW",
            ZIP = "NW16XE",
            Country = "England"
        }
    };
    // create options
    QrCodeSignOptions options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = card,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };

    // sign document to file
    signature.Sign("output.pdf", options);
}

Sign PDF with EPC payment in the QR-Code image

This example shows how to esign PDF with EPC / SEPA payment inside the QR-code image.

using (Signature signature = new Signature("sample.pdf"))
{
    // create EPC object
    EPC epc = new EPC()
    {
        Name = "Sherlock",
        BIC = "MrSherlockH",
        IBAN = "BE72000000001616",
        Amount = 123456.78D,
        Code = "SHRL",
        Reference = "Private service",
        Information = "Thanks for help"
    };
    // create options
    QrCodeSignOptions options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = epc,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };
    // sign document to file
    signature.Sign("output.pdf", options);
}

Sign PDF with Event information in the QR-Code image

This example shows how to esign PDF with event data inside the QR-code image.

using (Signature signature = new Signature("sample.pdf"))
{
    // create Event object
    Event evnt = new Event()
    {
        Title = "GTM(9-00)",
        Description = "General Team Meeting",
        Location = "Conference-Room",
        StartDate = DateTime.Now.Date.AddDays(1).AddHours(9),
        EndDate = DateTime.Now.Date.AddDays(1).AddHours(9).AddMinutes(30)
    };
    // create options
    QrCodeSignOptions options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = evnt,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };
    // sign document to file
    signature.Sign("output.pdf", options);
}

Sign PDF with CryptoCurrencyTransfer information in the QR-Code image

This example shows how to esign PDF with Cryptocurrency transfer data inside the QR-code image.

using (Signature signature = new Signature("sample.pdf"))
{
    // create crypto currency object
    CryptoCurrencyTransfer transfer = new CryptoCurrencyTransfer()
    {
        Type = CryptoCurrencyType.Bitcoin,
        Address = "1JHG2qjdk5Khiq7X5xQrr1wfigepJEK3t",
        Amount = 1234.56M,
        Message = "Consulting services"
    };
    // create alternative crypto currency object
    CryptoCurrencyTransfer customTransfer = new CryptoCurrencyTransfer()
    {
        Type = CryptoCurrencyType.Custom,
        CustomType = @"SuperCoin",
        Address = @"15N3yGu3UFHeyUNdzQ5sS3aRFRzu5Ae7EZ",
        Amount = 6543.21M,
        Message = @"Accounting services"
    };
    // create QR-code options
    QrCodeSignOptions options1 = new QrCodeSignOptions
    {
        // setup Data property to Address instance
        Data = transfer,
        Left = 10,
        Top = 10,
    };
    // create alternative QR-code options
    QrCodeSignOptions options2 = new QrCodeSignOptions
    {
        // setup Data property to Address instance
        Data = customTransfer,
        Left = 10,
        Top = 200
    };
    List<SignOptions> listOptions = new List<SignOptions>() { options1, options2 };
    // sign document to file
    signature.Sign("output.pdf", options);
}

Create an image with the WiFi QR Code information

This example shows how to create an image with the WiFi QR Code object.

using (Signature signature = new Signature("sample.png"))
{
    // create WiFi object
    WiFi wifi  = new WiFi()
    {
        SSID = "GuestNetwork!",
        Encryption = WiFiEncryptionType.WPAWPA2,
        Password = "guest",
        Hidden = false
    };

    // create options
    QrCodeSignOptions options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to WiFi object instance
        Data = wifi,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };

    // sign document to image file
    signature.Sign("output.png", options);
}

Sign PDF with SMS data information in the QR-Code

This example shows how to esign PDF with QR Code SMS data on the PDF page. This could be used for automatic document verification or subscription.

using (Signature signature = new Signature("sample.pdf"))
{
    // create SMS object
    SMS sms = new SMS()
    {
        Number = "0800 048 0408",
        Message = "Document approval automatic SMS message"
    };
    // create options
    QrCodeSignOptions options = new QrCodeSignOptions
    {
        EncodeType = QrCodeTypes.QR,
        // setup Data property to Address instance
        Data = sms,
        // set right bottom corner
        HorizontalAlignment = HorizontalAlignment.Right,
        VerticalAlignment = VerticalAlignment.Bottom,
        Width = 100,
        Height = 100,
        Margin = new Padding(10)
    };
    // sign document to file
    signature.Sign("output.pdf", options);
}

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 .NET library, we provide simple but powerful free online apps.

To generate QR codes and/or sign your files with QR codes for free, you can use the QR Code Generator online app.

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