GroupDocs.Conversion for Node.js via Java 23.11 Release Notes

Major Features

There are 8 features and bug fixes in this release:

  • Improved file type detection algorithm.
  • Added lzma format detection from input stream.
  • Fixed CSV and text to PDF conversion from input stream.
  • Fixed IFC to JPG conversion issue.
  • Fixed Word with Macros files conversion.
  • Fixed setFontDirectories method modifier.
  • Improved stability of work with some kinds of documents.
  • Added simplified public api to process document from stream

Full List of Issues Covering all Changes in this Release

KeyCategorySummary
CONVERSIONNODEJS‑108FixJava Conversion to PDF from text and CSV file do not generate PDF document
CONVERSIONNODEJS‑109FixIFC to JPG conversion issue
CONVERSIONNODEJS‑110FixIssue in converting Word file with Macros to JPG
CONVERSIONNODEJS‑111FixsetFontDirectories() method has a private access in ConverterSetting class
CONVERSIONNODEJS‑112FixSeek to the documentStream origin after using in Document
CONVERSIONNODEJS‑113ImprovementSimplify public api to process document from stream

Processing documents from stream simplified

Product public API provides easy and convenient readDataFromStream method to process documents from stream.

The following code snippet shows the method implementation and usage examples:

exports.readDataFromStream = function (readStream) {

  return new Promise((resolve, reject) => {
    const inputStreamBuffer = new exports.StreamBuffer()
    readStream.on('data', chunk => {
      inputStreamBuffer.write(chunk)
    })
    readStream.on('end', () => {
      try {
        resolve(inputStreamBuffer.toInputStream())
      } catch (err) {
        reject(err);
      }
    });
  });
}

The following code snippet shows how to set product license provided as stream:

const fs = require('fs')

async function setLicenseFromStream(groupdocs, licensePath) {
    const license = new groupdocs.conversion.License()
    const licenseStream = fs.createReadStream(licensePath)

    const stream = await groupdocs.conversion.readDataFromStream(licenseStream)    
    await license.setLicense(stream)
}
module.exports = setLicenseFromStream

The following code snippet shows how to view source file provided as stream:

const fs = require("fs")

async function loadDocumentFromStream(groupdocs, inputFilePath) {
  const outputPath = `LoadDocumentFromStream.docx`
  try {
    const docStream = fs.createReadStream(inputFilePath)
    const stream = await groupdocs.conversion.readDataFromStream(docStream)
    const converter = new groupdocs.conversion.Converter(stream)
    const convertOptions = new groupdocs.conversion.WordProcessingConvertOptions()

    console.log(`Source document converted successfully to ${outputPath}`)
    return converter.convert(outputPath, convertOptions)

  } catch (error) {
    throw new Error(error)
  }
}

module.exports = loadDocumentFromStream;

Public API and backward incompatible changes

None