Blog Post

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

MavenRespository

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

NugetUpload

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:

dotnet add package PSPDFKit.NET

Form Field Value Reading and Writing

FormFields

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:

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

var formProvider = _document.GetFormProvider();
formProvider.SetFormFieldValuesJson(valuesToSet);
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

FormFields

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:

var pdfProjection = document.GetProjection();

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

var rawRect = pdfProjection.ToRawRect(pdfRect, 0);
var pdfRect = pdfProjection.ToPdfRect(rawRect, 0);
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.

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

Share post
Free trial Ready to get started?
Free trial