Blog Post

PSPDFKit Libraries 1.1 for Java and .NET

Illustration: PSPDFKit Libraries 1.1 for Java and .NET

Today we’re shipping PSPDFKit Libraries 1.1. We decided that redaction is particularly important for our users, so we’ve expanded the functionality for Java and .NET to include an all-new RedactionProcessor API. You’ll also find some small additions and slight tweaks to the APIs, designed to make development even easier.

Redaction Processor

In PSPDFKit Libraries 1.0, it was already possible to add redaction annotations and redact the contents of a document. But in 1.1, we decided to make this process a whole lot easier. With the addition of the RedactionProcessor API, it’s possible to use regular expressions to redact content in a document or use one of our presets to redact common use cases. This means you will no longer have to manually search for the location of the data you would like to redact!

Here’s a sneak peek at the power of this new API:

// Redact all email addresses from the document.
RedactionProcessor.create()
    .addRedactionTemplates(new RedactionPreset.Builder(RedactionPreset.Type.EMAIL_ADDRESS).build())
    .redact(document);
// Redact all email addresses from the document.
RedactionProcessor.Create()
    .AddRedactionTemplates(new List<RedactionTemplate>
        {new RedactionPreset {Preset = RedactionPreset.Type.EmailAddress}})
    .Redact(document);

Find out more in the redaction guides for Java and .NET.

API Additions

A common use case is to open a document from a location and save it to another location. Because of this, we added SaveAs (saveAs in Java/SaveAs in .NET) functionality. Now it doesn’t matter where your document is opened from; you can apply all the changes you’d like and not touch the original location:

document.saveAs(new FileDataProvider(destinationFile), new DocumentSaveOptions.Builder().build());
document.SaveAs(new FileDataProvider(destinationFilePath), new DocumentSaveOptions());

The API works the same way as the original Save method, with the addition of a destination to write to. No changes will be made to the original source location throughout the entire process.

API Change for Opening Documents in Java

Previously, to open a document, you would have had to instantiate a PdfDocument. But now we’ve made some changes so that you can call a static open method in the PdfDocument class. This will allow for more flexibility in the future and less noise in the API documentation. For migration instructions, please see the Java 1.1 migration guide.

Final Notes

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

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