PSPDFKit Libraries 1.2 for Java and .NET

Today we’re shipping PSPDFKit Libraries 1.2. This release will make it easier to integrate PSPDFKit Libraries. The PSPDFKit Java Library is now distributed from a Maven repository, and the integration of the PSPDFKit .NET Library is now available in the NuGet central package repository. You’ll also find a few extra little additions and tweaks to further expand upon and simplify the use of the PSPDFKit Libraries products.

PSPDFKit Maven Repository for PSPDFKit Java Library

For most libraries out there in the Java space, it’s possible to download packages from a Maven repository. Maven is well supported throughout many build tools, which makes importing new libraries into your project painless.

So I’m happy to announce that the PSPDFKit Java Library is now available from our private Maven repository! This means there’s no longer the need to manage JAR files and dependencies! Just add a few lines into your build.gradle or pom.xml and you’re ready to go!

For more information on integrating the PSPDFKit Java Library into your project, please see our integration guide.

Public NuGet Repository for the PSPDFKit .NET Library

We made it easier to obtain the PSPDFKit Java Library, so why not do the same for the PSPDFKit .NET Library? From version 1.2, we are going to be pushing the package to the NuGet central package repository.

Integration will now be possible directly from Visual Studio or other supported IDEs. Or, if you’d prefer a cross-platform way of working, you can just use the dotnet command line application to import the PSPDFKit .NET Library into your project:

1
dotnet add package PSPDFKit.NET

Form Field Value Reading and Writing

Previously, it was possible to read and write form field values via XFDF, but we felt it was a little too clumsy. So we added a new feature that reads and writes form fields via an easy-to-use JSON API. Simply specify your field name as the JSON key and your value as the JSON value:

Copy
1
2
3
4
var valuesToSet = new JObject {{"HIGH SCHOOL DIPLOMA", new JArray("On")}, {"Birthdate", "12/12/12"}};

var formProvider = _document.GetFormProvider();
formProvider.SetFormFieldValuesJson(valuesToSet);
Copy
1
2
3
4
5
6
JSONObject valuesToSet = new JSONObject();
valuesToSet.put("HIGH SCHOOL DIPLOMA", jsonArrayOfString("On"));
valuesToSet.put("Birthdate", "12/12/12");

FormProvider formProvider = document.getFormProvider();
formProvider.setFormFieldValuesJson(valuesToSet);

You can find out more about this in the Form Filling in Java and Form Filling in .NET guides.

Document Page Information

It’s often important to know the dimensions and orientation of pages within a document. So we have expanded the page information available with the introduction of both a rotation API and a Projection class, the latter of which allows you to convert from the normalized PDF coordinate space into a “raw” coordinate space.

The raw coordinate space uses a point system, which many programmers will be familiar with, where the top-left corner of the page is x = 0, y = 0, and the bottom-right corner is x = width, y = height. In the PDF coordinate space, the bottom-left corner is x = 0, y = 0, and the top-right corner is x = width, y = height.

The new Projection class allows you to convert from one coordinate space to another, taking rotation and offsets into account, which means you can work in the coordinate space you’d prefer.

Here’s a sneak peek of the PDF Projection class that’s now in PSPDFKit Libraries:

Copy
1
2
3
4
5
6
var pdfProjection = document.GetProjection();

var pdfRect = new Rect(111, 222, 333, 444);

var rawRect = pdfProjection.ToRawRect(pdfRect, 0);
var pdfRect = pdfProjection.ToPdfRect(rawRect, 0);
Copy
1
2
3
4
5
6
PdfProjection pdfProjection = document.getPdfProjection();

Rect pdfRect = new Rect(111, 222, 333, 444);

Rect rawRect = pdfProjection.toRawRect(pdfRect, 0);
Rect pdfRect = pdfProjection.toPdfRect(rawRect, 0);

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.

PSPDFKit Library for Java/.NET

Download the free 60-day trial and integrate it into your app today.