Blog Post

PSPDFKit 2.5 for Windows

Today we’re shipping PSPDFKit 2.5 for Windows. This release features new API for restricting the editable annotation types, the ability to dynamically decide editability for individual annotations, additions to the TextParser for word extraction, and more.

Annotation Editability By Type

editability-type

When loading a document you can now easily restrict the set of annotations that can be created, edited, moved, and deleted.

Here is an example demonstrating how to limit editing to Note and Ink annotation types:

await pdfView.Controller.ShowDocumentWithViewStateAsync(document, new ViewState
{
    EditableAnnotationTypes = new HashSet<AnnotationType>
    {
        AnnotationType.Note,
        AnnotationType.Ink,
    }
});

Fine Grained Annotation Editability Control

editability-control

Sometimes you need finer grained control or very specific rules to determine whether or not an existing annotation should be editable.

With the Controller’s IsEditableAnnotation event handler you can easily add your own custom logic to do this.

The following example code is taken from the Catalog which you can find in the SDK:

public void Initialize(PdfView pdfView)
{
    pdfView.InitializationCompletedHandler += PDFView_InitializationCompletedHandler;
}

private async void PDFView_InitializationCompletedHandler(PdfView sender, PSPDFKit.Pdf.Document args)
{
    // Wire up a handler to be called whenever the UI needs to know if the annotation is editable or not.
    sender.Controller.IsEditableAnnotation += Controller_IsEditableAnnotation;
}

private void Controller_IsEditableAnnotation(Controller sender, AnnotationPermissionQuery args)
{
    // The second combo option: "Only Page 2 Annotations"
    if (EditabilityRule == 1)
    {
        // Decide if this annotation should be editable or not.
        args.Editable = args.Annotation.PageIndex == 1;
    }
}

Words From TextParser

text-parser-words

The TextParser can now convert a list of Glyphs retrieved from a page to a list of Words which contains the word’s bounding box, range of glyphs, and string content.

See the guide for more details and example code.

Final Notes

This release also includes a number of bug fixes and some minor improvements. For a complete list of changes, see the changelog.

Explore related topics

Related products
Share post
Free trial Ready to get started?
Free trial