PDFTron is now Apryse. Same great products, new name.

PDF Annotation Groups, Digital Signatures, Widgets and Undo/Redo with Apryse SDK 7.0.1 for UWP

By Mohammad Yasser Khan | 2019 Sep 06

Sanity Image
Read time

4 min

Well it is that time of the year again… when we release an update incorporating exciting new features to make PDF world an even better place. Do you dream about annotations that are grouped? If yes, then we have something special for you. We are pleased to announce the release of Apryse SDK for UWP version 7.0.1

Support for Annotation Groups

Our UWP PDF SDK now has UI support for selection and editing of existing Annotation Groups. You can also resize, change border and background color, change opacity, flatten the annotation group, delete the annotation group and ungroup the annotations.

To edit an existing Annotation Group you can click on the group with the Pan tool. This will select the group and will show options to perform on the group. You can also drag the Annotation Group to move it to a different location on the document and move the control points to resize all Annotations in the group together.

Edit an existing Annotation Group

New Widget APIs

Apryse SDK for UWP 7.0.1 comes with major improvements to the Widget APIs. In addition to getting/setting the Text color, Font and Font Size, now there are new Widget classes to help with form field creation/access. Here are the new Widget classes: TextWidgetCheckBoxWidgetRadioButtonWidgetRadioButtonGroupPushButtonWidgetSignatureWidgetListBoxWidgetComboBoxWidget

The following code snippet shows how to create a Text Widget:

    // Create a vertical text widget with blue text and a yellow background.
    TextWidget text = TextWidget.Create(document, new pdftron.PDF.Rect(50, 400, 90, 730));
    // Set the text content.
    text.SetText("    ****Lucky Stars!****");
    // Set the font type, text color, font size, border color and background color.
    text.SetFont(Font.Create(document, FontStandardType1Font.e_helvetica_oblique));
    text.SetTextColor(new ColorPt(0, 0, 1), 3);
    text.SetBorderColor(new ColorPt(0, 0, 0), 3);
    text.SetBackgroundColor(new ColorPt(1, 1, 0), 3);
    // Add the annotation to the page.

The following code snippet shows how to create a CheckBox Widget:

    // CheckBox Widget Creation
    // Create a check box widget that is checked.
    CheckBoxWidget check = CheckBoxWidget.Create(document, new pdftron.PDF.Rect(190, 490, 250, 540), "employee.name.check1");
    check.SetBackgroundColor(new ColorPt(1, 1, 1), 3);
    check.SetBorderColor(new ColorPt(0, 0, 0), 3);
    // Check the widget (by default it is unchecked).

For more use cases, see our InteractiveForms sample.

New Digital Signature API

Our SDK has an updated API to make Digital Signature creation easy. There are two new classes: DigitalSignatureField and DigitalSignatureIterator. We have updated our Digital Signature sample to show how the new API can be used.

The following code snippet shows how to sign a PDF:

    // Sign the approval signatures.
    Field foundApprovalField = document.GetField(inputApprovalFieldName);
    DigitalSignatureField foundApprovalSignatureDigitalSignatureField = new DigitalSignatureField(foundApprovalField);
    Image image = Image.Create(document.GetSDFDoc(), inputAppearanceImagePath);
    SignatureWidget foundApprovalSignatureWidget = new SignatureWidget(foundApprovalField.GetSDFObj());

The following code snippet shows how to certify a PDF:

	// Create a random text field that we can lock using the field permissions feature.
    TextWidget annotation = TextWidget.Create(document, new pdftron.PDF.Rect(50, 550, 350, 600), "asdf_test_field");

    /* Create new signature form field in the PDFDoc. */
    DigitalSignatureField certificationSignatureField = document.CreateDigitalSignatureField(inputCertificateFieldName);
    SignatureWidget widgetAnnot = SignatureWidget.Create(document, new pdftron.PDF.Rect(0, 100, 200, 150), certificationSignatureField);

    // (OPTIONAL) Add an appearance.

    // Widget AP from image
    Image image = Image.Create(document.GetSDFDoc(), inputAppearanceImagePath);
    // End of optional appearance-adding code.

    // Add permissions. Lock the random text field.
    WriteLine("Adding document permissions.");
    WriteLine("Adding field permissions.");
    string[] fieldsToLock = new string[1];
    fieldsToLock[0] = "asdf_test_field";
    certificationSignatureField.SetFieldPermissions(DigitalSignatureFieldFieldPermissions.e_include, fieldsToLock);

See our DigitalSignatures sample for more details.

Undo/Redo API

Everyone needs Undo/Redo. We listened to your feedback, and our UWP PDF SDK now comes with a low-level Undo/Redo API. Relevant classes are UndoManager, ResultSnapshot and DocSnapshot. We also have a new Undo/Redo sample to help you with using the new API.

Thank You

We hope the changes in our new release will make it even easier to build amazing applications/projects with our SDK. As always your feedback is instrumental in guiding our development, and we look forward to hearing from you on your experience with using this SDK release. Please provide your feedback at support@apryse.com. Thank You!

The new release comes with a host of improvements and bug fixes. For a full list of changes, please see the Apryse SDK 7.0.1 for UWP changelog.

We hope you like these changes and any feedback is greatly appreciated. Please don't hesitate and contact us if you have any questions or suggestions. We also have many exciting new features planned for the coming weeks and months. Stay tuned...

Sanity Image

Mohammad Yasser Khan

Share this post