NiXPS
Friday, July 17, 2009
  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("Base14FontEmbedding","DoNotEmbed");
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);

NOPackage.destroyPackage(ref lPackage);
 
Comments: Post a Comment

Subscribe to Post Comments [Atom]



Links to this post:

Create a Link



<< Home

Archives
September 2006 / October 2006 / November 2006 / December 2006 / January 2007 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / July 2007 / August 2007 / September 2007 / October 2007 / November 2007 / December 2007 / January 2008 / February 2008 / March 2008 / April 2008 / May 2008 / June 2008 / July 2008 / August 2008 / September 2008 / October 2008 / November 2008 / December 2008 / January 2009 / February 2009 / March 2009 / April 2009 / May 2009 / June 2009 / July 2009 / August 2009 / September 2009 / October 2009 / November 2009 / December 2009 / January 2010 / February 2010 / March 2010 / April 2010 / May 2010 / June 2010 / July 2010 / September 2010 / October 2010 / November 2010 / January 2011 /

NiXPS home
XPS info from the creators
    follow me on Twitter
    Add to Technorati Favorites

    Subscribe to
    Posts [Atom]