Many Performance Improvements, Document Signing and More in Aspose.Words 13.4.0

Aspose.Words Logo

This month’s release of Aspose.Words for .NET and Java contains a massive 154 improvements to Aspose.Words, including several big performance boosts and interesting new features.

You can immediately download our latest Aspose.Words release from the following links:

Here is a look at the biggest features in this release.

Performance Improvements to Many Areas of Aspose.Words

We are constantly tweaking all areas of Aspose.Words to improve performance where possible. In the recent releases of Aspose.Words there have been many performance improvements, the biggest of which are examined in closer detail:

Type Improvement Comments
Memory The amount of memory required to render a document has been reduced by more than 20-30%. This improvement allows very large documents consisting of thousands of pages to be rendered with less strain on memory. This is especially important on 32-bit systems where the amount of RAM that can be used is limited.
Speed Rendering of images to PDF improved by approximately 25% when saving with JPEG compression. Images in a document often undergo transformations before being included in the PDF output. This algorithm has been tweaked so an additional transformation is no longer required which results in a speed increase.
Speed The speed of which fields are updated (for instance when calling Document.UpdateFields) has been improved and in general, is around 2-3 times faster now. Improvements to how bookmarks are handled during field updates have brought a positive effect to field update performance in general. Further performance improvements for field updates are planned for future versions.
Size The size of images stored in PDF files generated by Aspose.Words has been reduced in many cases. With this improvement, it was observed with some documents the output PDF output file size is 1/10 the size.
Size Duplication of images could sometimes occur in some situations. This issue has been resolved and file size improved in these cases. A particular class of image was being duplicated across different story types which are now fixed.

Sign DOC, DOCX Documents and Remove Existing Digital Signatures

In this release Aspose.Words introduces support for digitally signing DOC and DOCX documents. A digital signature adds an extra layer of protection to a document and ensures that the document content has not been tampered with. This feature adds an “invisible” signature to the document, which is not to be confused with a signature line which is a digital signature accompanied by a normally handwritten signature image.

To demonstrate this feature, this is the code to sign a document on the file system using Aspose.Words (the code is in C#, however, note the feature is also available in Aspose.Words for Java as well).

// Load the certificate from disk.
// The other constructor overloads can be used to load certificates from different sources.
X509Certificate2 cert = new X509Certificate2(dataDir + "certificate.pfx", "password");

// Sign the document on disk using the loaded certificate.
// There is also an overload to sign a document from a stream.
DigitalSignatureUtil.Sign(dataDir + "TestFile.doc", dataDir + "TestFile Signed.doc", 
             cert, "Signing demonstration using Aspose.Words", DateTime.Now);

The signing process is performed using a separate static (shared) class called DigitalSignatureUtil and not by directly working on any already document in the DOM. The reason for this is because signing a digital signature is an external process that must be performed on an existing and already saved document.

Loading and Saving Office Open XML Documents without Compatibility Mode Warning

Documents created in earlier versions are opened in Microsoft Word in compatibility mode. This prevents new features not native to the format from being used and also preserves output.

It was found this compatibility warning was showing up with some documents loaded and saved using Aspose.Words due to the affected documents being originally saved in Microsoft Word 2010 format (ISO/IEC DIS 29500 2008 Transitional compliance) but resaved by Aspose.Words in the Microsoft Word 2007 format (ECMA-376 1st Edition compliance). This issue occurred because Aspose.Words was saving in this earlier format by default.

With this release Aspose.Words can now detect the compliance of a loaded OOXML document and resave the document using the correct compliance. This avoids the document being saved to the wrong specification and unexpected compatibility warnings.

Some additional useful notes:

  • You can still change the compliance of a document being saved at any time of a document by using the Compliance property of OoxmlSaveOptions.
  • A blank document created in Aspose.Words and saved to an OOXML format is still saved by default in Microsoft Word 2007 Format (ECMA-376 1st Edition compliance).