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