Reducing PDF size with NiXPS SDK v2.6.3
Our latest SDK release has a few options which potentially reduce the size of a converted PDF.
It's all about fonts. In some cases it is allowed in a PDF file not to embed fonts. This is the case for the so called 'Base 14' fonts, a list of 14 fonts that need not to be embedded. A PDF viewing or processing device is required to have this font available as part of its implementation.
For very small, text centric, PDF files, the biggest contributor to file size is the embedded font.
Of course, not embedding the font is potentially problematic, as this defeats the foundation that the document should be portable, and a such contain everything to be able to properly reproduce the document.
Nonetheless, in some cases it is a tradeoff some people like to take, and in v2.6.3 we have a few options which help out.
The first option is the "Base14FontEmbedding" option. If you set its value to "DoNotEmbed", the PDF converter will not embed the font when it is one of the base 14 set.
The second option, "Base14SimilarFonts", goes even a bit further, as it will replace fonts that are similar to the base 14 set, by a base 14 font, and subsequently not embed it.
Setting these options on documents that contain a lot of text in Helvetica, Times or Arial will yield significantly smaller PDF files.
To summarize, use it like this:
NOPackage lPackage = NOPackage.readPackageFromFile("in.xps");
NOOptions lOptions = new NOOptions();
lOptions.setOption("Base14SimilarFonts","DoNotEmbed"); // only if you want to replace similar fonts by a base 14
NOProgressReporter lReporter = new NOProgressReporter();
lPackage.exportToPDFWithOptions("out.pdf", lReporter, lOptions);