Blog Post

PSPDFKit 1.10 for Windows

Today we’re shipping PSPDFKit 1.10 for Windows. This release features new APIs for model-only document information retrieval, viewing and printing watermark support, additional toolbar customization, and more.

Please refer to our PSPDFKit 1.10 for Windows changelog for a complete list of changes in this release.

New Model API

model-only-api

Sometimes you need to retrieve information from a document but showing the document in a PdfView isn’t desired. With this release, we’ve added the ability to open a document independent of the PdfView and call the non-mutating methods on the Document class.

For example, you may wish to find out how many pages a document contains or retrieve annotations from a specific page. Here’s a short example demonstrating how to do that:

// In this example, we will open from a `StorageFile`.
var file = await GetMyStorageFileFromSomewhereAsync();

// Create a `DocumentSource` as per usual.
var source = DocumentSource.CreateFromStorageFile(file);

// Open the document without a `PdfView`.
var document = await Document.OpenDocumentAsync(source);

try
{
  // How many pages does this document contain?
  var numPages = await document.GetTotalPageCountAsync();

  // Get the annotations on the third page.
  var annotations = await document.GetAnnotationsAsync(2);
}
finally
{
  // Make sure to close it.
  await document.CloseDocumentAsync();
}

Watermarks

watermark

For some use cases, you may need to render a custom watermark on top of a PDF. Up until now, this wasn’t possible without having to modify the document itself. With this release, we’ve added the ability to render a SoftwareBitmap image on top of the page. These are set independently for viewing and printing.

Check out the printing example code in the Catalog app to see it in action.

Toolbar Customization

toolbar-customization

Dropdown grouping of the default toolbar items is useful for decluttering the toolbar. However, sometimes you may wish to ungroup one or more of those items and place them directly on the toolbar.

We added a new property, DropdownGroup, to the ToolbarItem’s Attributes. Setting this to an empty string ungroups the item and places it directly on the toolbar.

The following code example shows how to add a new ink toolbar item to the toolbar:

var toolbarItems = PDFView.GetToolbarItems();
toolbarItems.Add(
    new InkToolbarItem
    {
        Attributes = new Attributes
        {
            // Ensure the item is not assigned to any dropdown group.
            DropdownGroup = "",
        }
    }
);

await PDFView.SetToolbarItemsAsync(toolbarItems);

Annotation Rotation Attribute

rotated-text-annotation

Getting and setting the rotation of certain annotations is now supported. So now you’ll find the new Rotation property in the Text, Stamp, and Image annotation classes, where you can set the rotation in 90-degree increments.

This can be done when creating the annotation, as the following example demonstrates:

var annotation = new Text
{
    BoundingBox = new Rect(100, 100, 200, 30),
    FontColor = Colors.Blue,
    Contents = "Changed Text annotation",
    FontSize = 12,
    Rotation = RotationType.Degrees90
};

And Finally

Customers using Visual Studio 15.9 should be aware that it has a bug that may require you to modify your application’s project file until Microsoft releases a fix. Read more about it on our MSVC issues page.

Along with all the new features, this release also includes a number of bug fixes and some minor improvements. For a complete list of changes, see the changelog.

Author
Nick Winder Core Engineer

When Nick started tinkering with guitar effects pedals, he didn’t realize it’d take him all the way to a career in software. He has worked on products that communicate with space, blast Metallica to packed stadiums, and enable millions to use documents through Nutrient, but in his personal life, he enjoys the simplicity of running in the mountains.

Explore related topics

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