We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Webp format image does not appear in PDF when converting HTML to PDF

Hello,

We are using Aspose PDF java to convert HTML to PDF.
We noticed that if an HTML has an img tag with the src pointing to an image of the webp format, the image does not appear in the PDF. Is webp format supported?
Aspose version: 22.12

Sample webpimage.html:

<!DOCTYPE html>
<html lang="en"
  xmlns="http://www.w3.org/1999/xhtml"
><head>
<title></title>
<meta charset="utf-8"/>
</head>
<body>
<div>
<img src="https://www.gstatic.com/webp/gallery/1.webp" width="550" height="368" style="height: 368px; width: 550px;" alt="webp image"/>
</div>
</body>
</html>

An excerpt of the java code:

public void convert() throws Exception
{
	loadAsposeLicense();
	HtmlLoadOptions options = new HtmlLoadOptions();
	options.setInputEncoding(StandardCharsets.UTF_8.name());

	Document document = new Document(RESOURCE_DIR + "webpimage.html", options);
	document.setFitWindow(true);
	document.setLayersAdded(true);
	try(FileOutputStream fos = new FileOutputStream("webpimage.pdf"))
	{
		document.save(fos);
	}
	catch(FileNotFoundException e)
	{
		e.printStackTrace();
	}
	catch(IOException e)
	{
		e.printStackTrace();
	}
	finally
	{
		document.close();
	}
}

Thank you for help

Arjana Bivainiene

@arjana,

You are right, At the moment it seems that Aspose.Pdf version 23.2 does not support webp image format.

I will be creating a ticket for the development team.

@arjana
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): PDFNET-53859

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.