Error while converting the image to PDF

We are getting error when converting attached JPG images to PDF.
original Image files size is 4.8MB:
Figure 2.jpg (184.0 KB)

Note: But the size of image is compressed to 184.KB after attached here.

com.aspose.words.Document document = new com.aspose.words.Document();
DocumentBuilder builder = new DocumentBuilder(document);
builder.getPageSetup().setPaperSize(PaperSize.A4);
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
BufferedImage bf = null;
try
{
    // We try it with ImageIO
    bf = ImageIO.read(inputStream);
}
catch (CMMException ex)
{
    // If we failed...
    // We reset the inputStream (start from the beginning)
    inputStream.reset();
    // And use JAI
    bf = JAI.create("stream", SeekableStream.wrapInputStream(inputStream, true)).getAsBufferedImage();
}
Shape shape = builder.insertImage(bf);
shape.setWrapType(WrapType.NONE);
shape.setBehindText(true);
shape.setRelativeVerticalPosition(RelativeVerticalPosition.PAGE);
shape.setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE);
shape.setHorizontalAlignment(HorizontalAlignment.Center.getValue());
shape.setVerticalAlignment(VerticalAlignment.Center.getValue());
document.save(directoryPath + PATH_SEPARATOR + outputFileName, com.aspose.words.SaveFormat.PDF);
LOGGER.info(MessageConstants.CONVERTED_IMAGE_TO_PDF);
<dependency>
	<groupId>com.aspose</groupId>
	<artifactId>aspose-total</artifactId>
	<version>23.8</version>
	<type>pom</type>
</dependency>

@TandFSP The problem is not reproducible with the attached image on my side. Could you please zip and attach the original image here for testing, to avoid image compression?

Please find here the attached zip file of the image
Figure 2.jpg.zip (4.0 MB)

@TandFSP
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSJAVA-2938

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The problem occurs if insert image from BufferedImage if insert image from the file everything works fine. The following code does not throw:

Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
builder.insertImage("C:\\Temp\\Figure 2.jpg");
document.save("C:\\Temp\\out.pdf");

@TandFSP We have finished analyzing the issue and decided to close it as Not a Bug. This is bug of javax.imageio.ImageIO and we can’t fix it in our side.

The issues you have found earlier (filed as WORDSJAVA-2938) have been fixed in this Aspose.Words for Java 24.4 update.