GroupDocs.Conversion for Java 16.10.1 Release Notes

Major Features

There are 25 new features in this regular monthly release. The most notable are:

  • Detecting document type from streams.
  • Document conversion progress.
  • When converting to PDF return each page in separate stream
  • When converting to HTML return each page in separate stream
  • Place watermark in the converted document
  • Add support for converting to PSD format
  • Add support for converting from PSD format
  • Introducing two public interfaces IConversionProgressListener and IConversionStatusListener
  • Implement ConversionCompleted event with conversion details
  • Show grid lines when converting Excel files
  • Show hidden sheets when converting Excel files
  • Return conversion guid in ConversionProgressEventArgs
  • Conversion of SVG documents
  • Conversion of XPS documents
  • Conversion of ICO documents
  • When converting to Slides, option for removing slides comments
  • Fixed XLSX to PNG/JPG/HTML conversion
  • Respecting DPI option when converting to image
  • Conversion of Html to image
  • When converting from word, option for hide/show tracked changes in the converted document
  • Fixed respecting dpi setting when converting image to image 
  • Fixed respecting dpi setting when converting diagram to image
  • Converting from CAD documents to Cells, Html, Image, Pdf, Slides and Words
  • Setting default fonts to be used when converting from Slides if used font do not exist in the system
  • FixedLayout option when converting Word and Pdf to Html
  • Setting default Fonts

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
CONVERSIONNET‑680Implement document conversion from stream with auto detect source file typeNew Feature
CONVERSIONNET‑662Autodetect source document type when converting from streamNew Feature
CONVERSIONNET‑655Report conversion progressNew Feature
CONVERSIONNET‑654Return all supported conversions types with single methodNew Feature
CONVERSIONNET‑684When converting to PDF return each page in separate streamNew Feature
CONVERSIONNET‑685When converting to HTML return each page in separate streamNew Feature
CONVERSIONNET‑723Place watermark in the converted documentNew Feature
CONVERSIONNET‑724Add support for converting to PSD formatNew Feature
CONVERSIONNET‑725Add support for converting from PSD formatNew Feature
CONVERSIONNET‑789Implement ConversionCompleted event with conversion detailsNew Feature
CONVERSIONNET‑807ConversionStart eventNew Feature
CONVERSIONNET‑812Introducing two public interfaces IConversionProgressListener and IConversionStatusListenerNew Feature
CONVERSIONNET‑816Show grid lines when converting Excel filesNew Feature
CONVERSIONNET‑817Show hidden sheets when converting Excel filesNew Feature
CONVERSIONNET‑834Option for removing comments when converting slides documentsNew Feature
CONVERSIONNET‑835Implement SVG document conversionNew Feature
CONVERSIONNET‑846Implement XPS document conversionNew Feature
CONVERSIONNET‑886Implement conversion to ICONew Feature
CONVERSIONNET‑924Option when converting from Words for show/hide markup and tack changesNew Feature
CONVERSIONNET‑979Html to image conversionNew Feature
CONVERSIONNET‑1318Convert from CAD documents to Cells, Html, Image, Pdf, Slides, WordsNew Feature
CONVERSIONNET‑1077Setting default FontsNew Feature
CONVERSIONNET‑1305Add FixedLayout option to Words to Html conversionsNew Feature
CONVERSIONNET‑1304Add FixedLayout option to Pdf to Html conversionsNew Feature
CONVERSIONJAVA‑149Setting default FontsNew Feature
CONVERSIONJAVA‑118Implement functionality for convert Project file to multipage Tiff fileNew Feature
CONVERSIONNET‑765Return conversion guid in ConversionProgressEventArgsImprovement
CONVERSIONNET‑710Client Response - In-Proper conversion From PPTX to PDF, Image and Word Document formatsFix
CONVERSIONNET‑722Exception when converting from ODP to PPT and PPSFix
CONVERSIONNET‑734While Converting Xlsx file to HTML with HtmlSaveOptions Specific Pages (Sheets) does not workFix
CONVERSIONNET‑740Client Response - HTML to Doc and Docx is not proper for Headings and contents are mixedFix
CONVERSIONNET‑749Client Response - Only first page converts to PNG from TIF file (With and Without License)Fix
CONVERSIONNET‑750Client Response - Convert to HTML from Excel, PDF, MS Word overlaps the images AND some of Words with stylingFix
CONVERSIONNET‑757Can not find CallBack function to get Conversion Progress for MVC/WebForms ApplicationsFix
CONVERSIONNET‑767Client Respose - Could not open the file stream on azure.Fix
CONVERSIONNET‑782Client Response - FileType not supported Exceptions are not handledFix
CONVERSIONNET‑783Client Response - Error for Empty Input Documents as Stream for ConversionFix
CONVERSIONNET‑844xlsx to png Object null Reference exceptionFix
CONVERSIONNET‑889Conversion from XLSX to PNG/JPG/HTML not Working ProperlyFix
CONVERSIONNET‑890Converted File Name issue in Excel file to PNGFix
CONVERSIONNET‑897Converting large XLS file to image with UsePdf=false is producing blurred imagesFix
CONVERSIONNET‑898Missing pages when converting XLS file to image with UsePdf=trueFix
CONVERSIONNET‑899Excel to PNG/JPG/JPEG Low Image Quality Dpi not effecingFix
CONVERSIONNET‑907PDF to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑908Words to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑909Slides to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑910Tasks to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑911Image to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑912Diagram to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑911Image to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑912Diagram to Image conversion - target resolution is not changed when setting DpiFix
CONVERSIONNET‑1072 Txt to Pdf is causing “Unknown format” exceptionFix
CONVERSIONNET‑1078 % symbol in the file name trowns an exceptionFix
CONVERSIONNET‑1206Exception in HTML to Excel ConversionFix
CONVERSIONNET‑1207Convert Excel from Html - Table with background colour and some html controls are not converted properlyFix
CONVERSIONNET‑1351Coversion with document as Stream input not workingFix
CONVERSIONJAVA‑206Multithread conversion is not workingFix
CONVERSIONJAVA‑166Unable to convert excel files containing empty sheetsFix
CONVERSIONJAVA‑169Converting excel file to HTML not displaying the entire excel file.Fix
CONVERSIONJAVA‑140After conversion can’t render first page , throws an error “Out of Memory”Fix
CONVERSIONJAVA‑142Conversion .pptx to .pdf doesn’t work with multi-threadingFix
CONVERSIONJAVA‑144Header and footer incorrect rendered after conversion to .htmlFix
CONVERSIONJAVA‑115Using resolution parameter together height and width parametersFix
CONVERSIONJAVA‑133Count pages does not match specified number of pages after conversion.Fix
CONVERSIONJAVA‑135Static logger binder warningFix
CONVERSIONJAVA‑136Converted tiff file has incorrect page count in some TIFF viewersFix
CONVERSIONJAVA‑138Incorrect converts to png format.Fix
CONVERSIONJAVA‑139Conversion Jpg to Png trows an error “LoadingException”.Fix
CONVERSIONJAVA‑56Incorrectly resizing documents when converting to imageFix
CONVERSIONJAVA‑91Aspose.Words 15.8.0: Lost text after convertFix
CONVERSIONJAVA‑146Incorrect order of the documents after mergingFix
CONVERSIONJAVA‑131Output file after CCITT4 compression not rendered well in IBM Viewer and Google viewer.Fix
CONVERSIONJAVA‑148Path to image isn’t correct after conversion .xls document to .htmlFix
CONVERSIONJAVA‑163Image resolution/size is not effecting by changing DPIFix
CONVERSIONJAVA‑134com.groupdocs.conversion.exception.InternalException: Can’t convert to image! for conversion from .xls to multipage .tiff fileFix
CONVERSIONJAVA‑167ConversionHandler not releasing the source file’s resourceFix

Public API and Backward Incompatible Changes

How to get conversion progress

Here is an example of how to get conversion progress

String sourceFileName = "sample.docx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);
conversionHandler.ConversionProgress.add(new ConversionProgressHandler() {
    // Here is the implementation of the conversion progress handler method
    @Override
    public void invoke(ConversionProgressEventArgs args) {
        System.out.println("Conversion progress: {"+args.getProgress()+"}");
    }
});

PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setOutputType(OutputType.String);

String resultPath = conversionHandler.<String>convert(sourceFileName, saveOptions);

System.out.println("The conversion finished. The result can be located here: "+resultPath+". Press <<ENTER>> to exit.");

How to place watermark in converted document

String sourceFileName = "sample.docx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setOutputType(OutputType.String);
WatermarkOptions watermarkOptions = new WatermarkOptions("Watermark text");
watermarkOptions.setColor(Color.blue);
watermarkOptions.setFont(new Font("Arial", 40, 12));
watermarkOptions.setRotationAngle(45);
watermarkOptions.setTransparency(0.1);
watermarkOptions.setLeft(200);
watermarkOptions.setTop(400);
saveOptions.setWatermarkOptions(watermarkOptions);

String result = conversionHandler.<String>convert(sourceFileName, saveOptions);
System.out.println("The conversion finished. The result can be located here: "+result+". Press <<ENTER>> to exit.");

How to convert to PSD

String sourceFileName = "sample.docx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
ImageSaveOptions saveOptions = new ImageSaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setConvertFileType(ImageSaveOptions.ImageFileType.PSD);
PsdOptions psdOptions = new PsdOptions();
psdOptions.setColorMode(PsdOptions.ColorModes.GRAYSCALE);
psdOptions.setCompressionMethod(PsdOptions.CompressionMethods.RAW);
saveOptions.setPsdOptions(psdOptions);

List<String> result = conversionHandler.<List<String>>convert(sourceFileName , saveOptions);

How to convert from PSD

String sourceFileName = "Sample.psd"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
SaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setOutputType(OutputType.String);

String result = conversionHandler.<String>convert(sourceFileName, saveOptions);

How to use ConversionStart, ConversionProgress and ConversionComplete events

String sourceFileName = "sample.docx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

conversionHandler.ConversionStart.add(new ConversionStartHandler() {
    @Override
    public void invoke(ConversionStartEventArgs args) {
        System.out.println("Conversion " + args.getConversionGuid() + " started");
    }
});

conversionHandler.ConversionProgress.add(new ConversionProgressHandler() {
    @Override
    public void invoke(ConversionProgressEventArgs args) {
        System.out.println("Conversion " + args.getConversionGuid() + " progress: " + args.getProgress() + " %");
    }
});

conversionHandler.ConversionComplete.add(new ConversionCompleteHandler() {
    @Override
    public void invoke(ConversionCompleteEventArgs args) {
        System.out.println("Conversion " + args.getConversionGuid() + " completed");
        System.out.println("Result document is " + args.getConversionType() + ". Cache is " + args.getUsedCache());
        System.out.println("Result document has " + ((PdfConversionCompleteEventArgs) args).getPageCount() + " page(s).")
    }
});

// Save options
SaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setOutputType(OutputType.String);

String result = conversionHandler.<String>convert(sourceFileName, saveOptions);

How to use IConversionProgressListener and IConversionStatusListener to receive conversion status changes and progress info

Defining conversion callbacks receiver

public class ConversionManager implements IConversionProgressListener, IConversionStatusListener {
    private final ConversionHandler _conversionHandler;
    public ConversionManager(String path) {
        _conversionHandler = Common.getConversionHandler();
        _conversionHandler.setConversionProgressListener(this);
        _conversionHandler.setConversionStatusListener(this);
    }
    @Override
    public void conversionProgressChanged(ConversionProgressEventArgs args) {
        System.out.println("Conversion progress: " + args.getProgress() + " %");
    }
    @Override
    public void conversionStatusChanged(ConversionEventArgs args) {
        System.out.println("Conversion status changed to: " + args.getStatus());
    }
    public String convert(String file) throws IOException {
        PdfSaveOptions option = new PdfSaveOptions();
        option.setOutputType(OutputType.String);

        return _conversionHandler.<String>convert(file, option);
    }
}

Usage of the conversion callback receiver for getting updates from conversion

String sourceFileName = "sample.docx"; //TODO: Put the source filename here
String storagePath = ".";
ConversionManager manager = new ConversionManager(storagePath);

String result = manager.convert(sourceFileName);
System.out.println(result);

How to show grid lines when converting from Excel

String sourceFileName = "sample.xlsx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
SaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setShowGridLines(true);

String result = conversionHandler.<String>convert(sourceFileName, saveOptions);

How to show hidden sheets when converting from Excel

String sourceFileName = "sample.xlsx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
SaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setShowHiddenSheets(true);
String result = conversionHandler.<String>convert(sourceFileName, saveOptions);

How to remove slides comments when converting to Slides

String sourceFileName = "sample.pptx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
SlidesSaveOptions saveOptions = new SlidesSaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setRemoveSlidesComments(true);

String result = conversionHandler.<String>convert(sourceFileName, saveOptions);

How to hide tracked changes when converting from Words

String sourceFileName = "sample.docx"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("CACHE_PATH");
conversionConfig.setStoragePath("STORAGE_PATH");
conversionConfig.setOutputPath("OUTPUT_PATH");

ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
SaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setHideWordTrackedChanges(true);

String result = conversionHandler.<String>convert(sourceFileName, saveOptions);

How to convert html to image

String sourceFileName = "sample.html"; //TODO: Put the source filename here

// Setup Conversion configuration
ConversionConfig conversionConfig = new ConversionConfig();
conversionConfig.setCachePath("cache");
conversionConfig.setStoragePath(".");
ConversionHandler conversionHandler = new ConversionHandler(conversionConfig);

// Save options
ImageSaveOptions saveOptions = new ImageSaveOptions();
saveOptions.setOutputType(OutputType.String);
saveOptions.setDpi(300);
List<String> result = conversionHandler.<List<String>>convert(sourceFileName, saveOptions);

Introduced SlidesLoadOptions with ability to specify default font for rendering if a presentation font is missing

SlidesLoadOptions loadOptions = new SlidesLoadOptions();
loadOptions.setPassword("secret");
loadOptions.setDefaultFont("Verdana"); // Default font for rendering the presentation. The following font will be used if a presentation font is missing.

HtmlSaveOptions class is extended with new property - FixedLayout - if true html will be rendered with absolutely positioned elements

HtmlSaveOptions saveOptions1 = new HtmlSaveOptions();
saveOptions1.setFixedLayout(true);