GroupDocs.Conversion for Java 26.9 Release Notes

Major Features

There are 3+ features and bug fixes in this release:

  • Introduced cooperative cancellation support for document conversion.
  • Added conversions between Bzip2, Gzip, LZMA, and XZ, and conversion from Unix Z to these formats.
  • Added a stable Java module name for applications using the Java module system.

Full List of Issues Covering all Changes in this Release

The following .NET issue keys identify features ported to Java. Their summaries reflect the formats implemented in this Java release.

KeyCategorySummary
CONVERSIONNET-6880FeatureSupport cooperative cancellation through cancellation tokens
CONVERSIONNET-7032FeatureConvert Bzip2, Gzip, XZ, and Unix Z to LZMA
CONVERSIONNET-7019FeatureConvert LZMA to Bzip2 and Gzip
CONVERSIONNET-7020FeatureConvert Unix Z to Bzip2 and Gzip
CONVERSIONNET-7030FeatureConvert Bzip2, Gzip, LZMA, and Unix Z to XZ
CONVERSIONNET-7029FeatureConvert XZ to Bzip2 and Gzip
CONVERSIONNET-7028FeatureConvert Gzip to Bzip2
CONVERSIONNET-7021FeatureConvert Bzip2 to Gzip
CONVERSIONJAVA-3238Task[Quality] Fix package verification findings in groupdocs-conversion-26.7.jar

Public API and backward incompatible changes

Cancellation support

  1. Added com.groupdocs.conversion.CancellationToken and com.groupdocs.conversion.CancellationTokenSource.
  2. Added overloads of all public Converter.convert(...) methods and Converter.convertPageByPage(...) with a final CancellationToken parameter. Existing overloads remain available and use CancellationToken.NONE, so existing calls do not require changes.
  3. Added ConversionExecutor.convert(CancellationToken).

Use CancellationTokenSource.getToken() to pass a cancellation signal to conversion, and call cancel() on that source to request cancellation, including from another thread. A cancelled source cannot be reset.

import com.groupdocs.conversion.CancellationTokenSource;
import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;

CancellationTokenSource cancellationSource = new CancellationTokenSource();

try(Converter converter = new Converter("input.docx")) {
        converter.convert("converted.pdf",new PdfConvertOptions(),cancellationSource.          getToken());
}

Cancellation is checked between conversion operations. An operation already running finishes before cancellation is observed. Cancellation raises java.util.concurrent.CancellationException; output already written is not rolled back. Passing a null token raises NullPointerException.

Compression conversion support

Use CompressionConvertOptions.setFormat(...) to select the target compression format.

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.filetypes.CompressionFileType;
import com.groupdocs.conversion.options.convert.CompressionConvertOptions;

CompressionConvertOptions options = new CompressionConvertOptions();
options.setFormat(CompressionFileType.Lzma);

try(Converter converter = new Converter("input.gz")) {
        converter.convert("converted.lzma",options);
}

Supported compressed-stream sources are Bzip2 (Bz2), Gzip (Gz and Gzip), LZMA (Lzma), XZ (Xz), and Unix Z (Z). Supported targets are Bzip2, Gzip, LZMA, and XZ, including same-format conversion.

The advertised archive conversion pairs are now restricted to conversions within ZIP, 7z, TAR, and CPIO. Applications relying on the previous advertised archive-to-compressed-stream pairs should review the available conversions before upgrading.

Java module name

The release JAR declares Automatic-Module-Name: com.groupdocs.conversion, providing a stable name for applications using the Java module system.