NiXPS SDK v2.6.2 maintenance update released
We have release NiXPS SDK v2.6.2, which is a maintenance update.
This is a release with bugfixes, optimizations and a few new features.
One notable new feature is the fact that from now on you can reference the DLL in your .NET project.
You need to reference the binaries that are located in the 'bin/dotnet' directory for this, as these are the only ones that contain the C# classes (the former glue code you could find in the .NET example).
You should not need the C# glue code anymore.
You can find the changelog for this v2.6.2 release
here.
You can apply for your trial version
here.
You'll receive a link to download the SDK.
NiXPS assembly can now be referenced in .NET
A lot of our customers are using the NiXPS SDK in a .NET environment.
As our SDK is essentially a 'native' (unmanaged) library, it can be used in .NET via managed/unmanaged interop.
We have shielded this complexity for the user, and provide a C# object model that in its implementation calls further into the native NiXPS dll.
Now, for v2.6.2 we went a step further and are releasing a fully integrated .NET assembly.
This assembly is a class library that contains the object model, and has also the native NiXPS dll embedded.
As a result a .NET developer doesn't need the C# glue objects anymore, he now only needs to reference the NiXPS assembly to be able to work with our SDK.
(This will be part of the upcoming v2.6.2 release; the integrated .NET assemblies can be found in the bin/.net folder in the SDK archive.)
Combine XPS documents: add header and footer
In a document workflow it is very common that different parts of a document come from separate sources.
The typical example is the document flow of invoices.
Generally invoices are generated by software that is tied to the accountancy department of a company. This invoice is then printed on company letterhead, and send out.
Ideally: to keep documents fully electronic, this last stage, combine invoice and letterhead, needs to be done in software. And both XPS and NiXPS can come to the rescue here.
First of all, getting an XPS version of an invoice out of your accounting software is very easy. With help of the free virtual XPS printer that is delivered with windows you can print from your software to an XPS file.
Of course, in a document flow invoice generation is much more automated. Chances are the accounting software can be customized to print, or even an integration with .NET is possible, so XPS can be generated on the fly.
Then combining this invoice with a company logo and a footer can be done with our upcoming NiXPS SDK v2.6.2 and the new function: copyPageOnTop().
Literally in a few lines of C# it is possible to combine any number of XPS pages, the NiXPS SDK takes care of the housekeeping needed to do this.
Let me walk you through an example for this; We have an invoice (invoice.xps) file, which we will combine with our company logo (logo.xps) and a footer (footer.xps).
First thing to do in the function: open up all our XPS files:
public static void Main(string[] args)
{
NOPackage lInvoice = NOPackage.readPackageFromFile("../testfiles/invoice.xps");
NOPackage lLogo = NOPackage.readPackageFromFile("../testfiles/logo.xps");
NOPackage lFooter = NOPackage.readPackageFromFile("../testfiles/footer.xps");
The logo.xps has the logo in page 1. Our invoice is also a one pager; So to combine them we will copy page 1 of the logo.xps on top of page 1 of invoice.xps.
This will return a handle to a NOXCanvas:
NOXCanvas lLogoCanvas=lInvoice.getDocument(0).getPage(0).copyPageOnTop(lLogo.getDocument(0).getPage(0));
This NOXCanvas is a handle to the content that was inserted.
This allows to do some customization: in this example we will apply a transformation matrix to scale the logo to 60%, and move it to position (30,30):
lLogoCanvas.setRenderTransform("0.6,0,0,0.6,30,30");
Same thing for the footer, copy page on top, and transform:
NOXCanvas lFooterCanvas = lInvoice.getDocument(0).getPage(0).copyPageOnTop(lFooter.getDocument(0).getPage(0));
lFooterCanvas.setRenderTransform("0.72,0,0,0.72,0,100");
Write out the file and clean-up:
lInvoice.writePackageToFile("../output/out.xps");
NOPackage.destroyPackage(ref lInvoice);
NOPackage.destroyPackage(ref lLogo);
NOPackage.destroyPackage(ref lFooter);
}
And that's it!
To download the SDK in trial: fill out this form, you'll receive a download link (and no spam).
NiXPS Edit v2.6 reviewed at IT Enquirer
There's a review of our NiXPS Edit v2.6 XPS editor over at IT Enquirer:
here.