Cannot convert png/tiff to pdf

I am trying to convert PNG’s and TIFF’s to PDFs.

I am running Apose.PDF version 17.2.0 for Java on a Linux machine. Attached is the problematic PNG. I am having the same issue for TIFFs.

The following java code is failing with Document Conversion Error on Linux (Interestingly the code works on a mac):

Document document = new Document();

    Page page = document.getPages().add();        
    Image image = new Image();

	BufferedImage bufImage;
	try {
		bufImage = File(fullFilePath));
	} catch (IOException e) {

	// Get the width and height of the image
	int width = bufImage.getWidth();
	int height = bufImage.getHeight();

	double ratio = (double) 525 / (double) width;

	double effectiveHeight = (double) ratio * (double) height;

	int bottomMargin = 842 - (int)effectiveHeight;


    page.getPageInfo().getMargin().setRight (0);
    page.getPageInfo().getMargin().setLeft (0);

    page.getParagraphs().add(image);   ;

For ping.PNG (24.3 KB)


Please read the following article to convert PNG to PDF and use the latest version of Aspose.PDF for Java 22.12.
Convert PNG to PDF

We have converted the shared image to PDF and have not found any issue with output PDF. Please check the attached output PDF.
PNGtoPDF.pdf (90.6 KB)