Aspose.Words for Java 18.4 Release Notes

Major Features

There are 75 improvements and fixes in this regular monthly release. The most notable are:

  • Added public Ref<T> class for out/ref emulation in public API.
  • Provide an ability to work with password-protected ODT and OTT file formats
  • Preserve PaperTray information in PCL       
  • Added ShapeBase.IsLayoutInCell property 
  • Implemented optimization of metafile rendering vector output. Optimization includes applying intermediate transformations directly to the graphics and removing redundant canvases. Such optimization is also performed by MW when saving metafiles as vector graphics to PDF, XPS, etc.
  • PaperTray information is now saved in PCL output
  • “DrawingML shapes are not fully supported” warning is not thrown anymore, more specific warnings are used instead while rendering
  • DrawingML shapes with auto-size and empty textboxes don’t throw exception while rendering now
  • WordArt objects with empty fill now cast only outline shadows while rendering. Previously the whole shape cast a shadow
  • Improved rendering of MathAccentElement. The accent symbol is rendered in accordance with the letter’s height
  • Improved rendering of PieChart, if data labels have a manual layout
  • Improved rendering of the text boxes with OleObjects (e.g. Math equation)
  • Improved rendering of WordArt objects with gradient fill
  • Fixed a bug causing the corruption of radial gradient fill for rotated shapes while rendering
  • Fixed rendering of “Monotype Hadassah” font with legacy encoding
  • Fixed a problem with META_SETPIXEL WMF record while rendering meta-files
  • Improved frame width calculation when paragraph has right indent
  • Improved computation of widths of ideographic space when combined with document grid, space inside footnotes
  • Improved floating table positioning for RTL tables in 2013 compatibility mode
  • Improved layout of 2013 compatible documents when page break overlaps footer
  • Improved positioning of wrapped lines in 2013 compatibility mode, and lines with large inline images
  • Fixed issue with character compressing when Kinsoku rule is ignored by document
  • Fixed incorrect glyph selection for Zero Width No-Break Space when font does not have this glyph
  • Fixed comment range highlighting issue when comment spans multiple pages inside a repeated header row of a table
  • Fixed rendering of text in merged cells when row contains hidemark attribute on the cell break and all remaining cells are merged

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
WORDSJAVA-1737Multiple Print Jobs for each Page in a Single Document CreatedBug
WORDSJAVA-1740Black and white is inverted in TIFF Viewer when converting from DOCX to TIFFBug
WORDSJAVA-1741Images background is changed to black color after conversion from DOCX to PDF/ABug
WORDSJAVA-1742Yellow background not same after converting docx to PDFBug
WORDSJAVA-1744ResolutionUnit Tag is not set when converting from DOCX to TIFFBug
WORDSJAVA-1709New Digital Signature OfficeCrypto ODT tests.Enhancement
WORDSJAVA-1710Autodetection of Japanese encoding in short text file.Enhancement
WORDSJAVA-1769How to save Tiff in the Intel Encoding/byte order.Enhancement
WORDSJAVA-1756Public Ref class for out/ref emulation in public API.Feature
WORDSNET-16587Content are pushed down to the page in output PDFBug
WORDSNET-16585DOCX to PDF - text split next lineBug
WORDSNET-16580The output PDF document contains blank page after page 9.Bug
WORDSNET-16578Missing text during word to pdf conversionBug
WORDSNET-16567OMathPara with added text is “inline” in DOCX, but not “inline” in PDF.Bug
WORDSNET-16563Cell background becomes black upon renderingBug
WORDSNET-16559Japanese characters are misaligned in PDFBug
WORDSNET-16557Aspose.Words.UnsupportedFileFormatException is thrown for DOTXBug
WORDSNET-16525Some artifacts in AutoCAD.Drawing.18 are dimmed or missed in PDFBug
WORDSNET-16523Field.Unlink does not unlink IF fieldsBug
WORDSNET-16514DocumentBuilder.InsertImage causes issue with vertical dashed lines in SVG drawings for PDFBug
WORDSNET-16510Handle “DrawingML shapes are not fully supported” warning correctlyBug
WORDSNET-16507WordArt Style lost in PDFBug
WORDSNET-16505Image presentation of OLE object is changed after re-saving ODTBug
WORDSNET-16502DOCX to PDF - ToC link not pointing to same tableBug
WORDSNET-16500Character is being turned in to “6” in PDFBug
WORDSNET-16484DOCX to PDF conversion issue with zero width no-break space characterBug
WORDSNET-16482PDF output is corrupted after renditionBug
WORDSNET-16467Chart image is not rendered correctly in output PDFBug
WORDSNET-16465Math equation is truncated after conversion from DOC to PDFBug
WORDSNET-16460Syntax issue in output PDFBug
WORDSNET-16450Wrong radial gradient if object is rotatedBug
WORDSNET-16449Wrong pen thickness in EMF metafileBug
WORDSNET-16446DocumentBuilder.InsertImage causes issue with dashed lines in SVG drawingsBug
WORDSNET-16440Y position of the line after floaters is computed improperly for MS Word 2013Bug
WORDSNET-16422A Drawing truncates from right in PDFBug
WORDSNET-16418System.NullReferenceException is thrown when RevisionOptions.ShowRevisionBalloons is set to true.Bug
WORDSNET-16393Charts’ size is smaller in output PDFBug
WORDSNET-16350Incorrect TOC page number in RTF to DOCX conversionBug
WORDSNET-16337WordArt is not rendered correctlyBug
WORDSNET-16303Insert revisions are inserted into Document using Document.TrackRevisionsBug
WORDSNET-16289Images have been misplaced in PDF output.Bug
WORDSNET-16252DOCX to PDF issue with Characters with above bar lineBug
WORDSNET-16169Highlighted text issue in Rendered PDFBug
WORDSNET-16072Page and Table margin are not preserved during DOCX-HTML-DOCX round tripBug
WORDSNET-15226List label is changed after conversion from DOC to DOCX/PDFBug
WORDSNET-15016Paragraph text inside StructuredDocumentTag is not modified after DOCX-HTML-DOCX round tripBug
WORDSNET-14763Diagram Shapes coming oddly when exporting Word to HTMLBug
WORDSNET-11370/table grid/ Barcodes and Tables do not render to their complete widths in PDFBug
WORDSNET-9743Some images are missing from output PdfBug
WORDSNET-7586Support C1 control character mapping (MHTML to Tiff conversion issue with text rendering after lower quotes)Bug
WORDSNET-6840Table background Shading color is not preserved when saving to MHTMLBug
WORDSNET-5799Text of list items in a comment is not renderedBug
WORDSNET-16546Watermark on each page is not at correct positionEnhancement
WORDSNET-16530Loading RTF hangsEnhancement
WORDSNET-16490DOCX to PDF - text moved to rightEnhancement
WORDSNET-16479Add warnings when document has issues with its contentEnhancement
WORDSNET-16396Remove obsolete LoadOptions.WebRequestTimeoutEnhancement
WORDSNET-16349Review the methods depending on DocPr.IsGutterSide as it may return an incorrect valueEnhancement
WORDSNET-15811Incorrect digital signing with DSA certificateEnhancement
WORDSNET-15490DOCX to PDF conversion issue with text colorEnhancement
WORDSNET-15004Formatting of StructuredDocumentTag is lost during DOCX-HTML-DOCX round tripEnhancement
WORDSNETSTD-47TypeInitializationException on .NET StandardException
WORDSNET-16584System.NullReferenceException occurs upon rendering to PDFException
WORDSNET-16552System.NullReferenceException is thrown while saving DOCX to PDFException
WORDSNET-16541FileCorruptedException loading html with SVGException
WORDSNET-16456Document.ImportNode throws System.InvalidOperationExceptionException
WORDSNET-16453An exception raises while saving the output in PDF format.Exception
WORDSNET-16425FileCorruptedException occurs upon loading a ODTException
WORDSNET-16408System.InvalidCastException occurs when loading a ODT fileException
WORDSNET-16135Appending document throws InvalidOperation ExceptionException
WORDSNET-16513Provide ability to extract Subject and the Issuer of a certificateFeature
WORDSNET-16391Preserve PaperTray information in PCLFeature
WORDSNET-16353Improve the rendering of compound lines and DrawingML shapesFeature
WORDSNET-16133Provide an ability to work with password-protected ODT and OTT file formatsFeature
WORDSNET-16565UpdateFields caused hidden fields to be shownRegression

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 18.4. It includes not only new and obsoleted public methods, but also a description of any changes in the behavior behind the scenes in Aspose. Words which may affect existing code. Any behavior introduced that could be seen as a regression and modifies existing behavior is especially important and is documented here.

Public Ref Class for out-ref Emulation in Public Java API

Related issue: WORDSJAVA-1756

On .NET baseline, some public API methods contain out/ref params in signatures. Service classes Ref<T>, RefInt, RefBoolean, etc. are added to emulate out/ref in Java.

Now, the code like:

void SomeMethod(ref Document doc, out int i)

is autoported to Java as:

void someMethod(Ref<Document> doc, RefInt i)

The Ref* classes contain get() and set() methods to get and set the value.

Ability to Work with Password-Protected ODT and OTT File Formats Added

Related issue: WORDSNET-16133

Supported encryption for ODF documents.

The following public API has been added to the OdtSaveOptions class:

/// <summary>
/// Initializes a new instance of this class that can be used to save a document in the <see cref="Words.SaveFormat.Odt"/> format
/// encrypted with a password.
/// </summary>
public OdtSaveOptions(String password)
/// <summary>
/// Gets or sets a password to encrypt document.
/// </summary>
/// <remarks>
/// <para>In order to save document without encryption this property should be null or empty string.</para>
/// </remarks>
public String Password

UC1: Load encrypted ODT document.

Document doc = new Document("\\encrypted.odt", new LoadOptions("password"));

UC2: Save ODT document encrypted with a password.

Document doc = new Document();
doc.save("\\encryped.odt", new OdtSaveOptions("password"));
UC3: Verify ODT document is encrypted.
FileFormatInfo info = FileFormatUtil.detectFileFormat("\\encryped.odt");
System.out.println(info.isEncrypted());

Ability to Preserve PaperTray Information in PCL Added

Related issue: WORDSNET-16391

Paper tray information is now preserved when saving document to PCL format. Following information is transferred from document’s model to PCL file:

PageSetup.FirstPageTray
PageSetup.OtherPagesTray

No additional code is required. Please note the value of paper tray is passed from document “as is”. PCL format supports only 8-bit identifiers for paper tray so make sure this values are correct for PCL printer.

Added ShapeBase.IsLayoutInCell property

Related issue: WORDSNET-16546

The following public property has been added into the ShapeBase class:

/// <summary>
/// Gets or sets a flag indicating whether the shape is displayed inside a table or outside of it.
/// </summary>
/// <remarks>
/// The default value is <b>true</b>.
/// Has effect only for top level shapes, the property <see cref="WrapType"/> of which is set to value
/// other than <see cref="WrapType.Inline"/>.
/// </remarks>
public boolean isLayoutInCell
{
    get; set;
}

The property may be helpful for shapes (mainly VML) that are placed into a table cell but are needed to position without binding to the cell.

Usage

Document doc = new Document(dataDir + "LayoutInCell.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
Shape watermark = new Shape(doc, ShapeType.TEXT_PLAIN_TEXT);
watermark.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
watermark.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
watermark.isLayoutInCell(false);
 // Display the shape outside of table cell if it will be placed into a cell.
watermark.setWidth(300);
watermark.setHeight(70);
watermark.setHorizontalAlignment(HorizontalAlignment.CENTER);
watermark.setVerticalAlignment(VerticalAlignment.CENTER);
watermark.setRotation(-40);
watermark.getFill().setColor(Color.GRAY);
watermark.setStrokeColor(Color.GRAY);
watermark.getTextPath().setText("watermarkText");
watermark.getTextPath().setFontFamily("Arial");
watermark.setName("WaterMark_0");
watermark.setWrapType(WrapType.NONE);
Run run = (Run) doc.getChildNodes(NodeType.RUN, true).get(doc.getChildNodes(NodeType.RUN, true).getCount() - 1);
builder.moveTo(run);
builder.insertNode(watermark);
doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2010);

// Save the document to disk.
dataDir = dataDir + "Shape_IsLayoutInCell_out.docx";
doc.save(dataDir);

Optimization of Vector Graphics Output of Metafile Rendering

Related issues: WORDSNET-16449, WORDSNET-15490

Implemented optimization of metafile rendering vector output. Optimization includes applying intermediate transformations directly to the graphics and removing redundant canvases. Such optimization is also performed by MW when saving metafiles as vector graphics to PDF, XPS, etc.

Optimization may affect the visual appearance of metafile vector graphics in viewer applications due to peculiarities of vector graphics rendering. For example, there are cases when not optimized output looks faded out in Acrobat Reader comparing to optimized output.

Metafile output optimization is controlled by existing FixedPageSaveOptions.OptimizeOutput flag.

Obsolete property LoadOptions.WebRequestTimeout was removed

Obsolete property WebRequestTimeout was removed from the LoadOptions class. Please use the HtmlLoadOptions.WebRequestTimeout property instead.