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

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:

Copy
1
2
3
4
5
6
7
8
await pdfView.Controller.ShowDocumentWithViewStateAsync(document, new ViewState
{
    EditableAnnotationTypes = new HashSet<AnnotationType>
    {
        AnnotationType.Note,
        AnnotationType.Ink,
    }
});

Fine Grained Annotation 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:

Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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

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.

PSPDFKit for Windows

Download the free 60-day trial and add it to your app today.

The data you submit is treated confidentially and will never be disclosed to third parties.
We may occasionally send you product news and important announcements.