Add Image from URL instead of path

I’m creating a PDF document using the Document class of com.aspose.pdf package and I want to add an Image from a specific url in my generated PDF document. However, I can’t seem to find a way to do this and nothing is mentioned in the documentation.

In order to load the image from a path I do the following:

Java

com.aspose.pdf.Image img1 = new com.aspose.pdf.Image();
img1.setFile("C:\\Users\\myusername\\Desktop\\testImg.jpg");
img1.setFixWidth(100);
img1.setFixHeight(100);
row.getCells().get_Item(colIndex).getParagraphs().add(img1); 

Is it possible to adjust this in order to retrieve an Image from a URL instead of a file path?

@P1ranhas,

ImageStream member allows to set input stream of the image. Please try the following code:

[Java]

com.aspose.pdf.Image image1 = new com.aspose.pdf.Image();
URL url = new URL("http:/abc.com/world.jpg");
BufferedImage bufferinput = ImageIO.read(url);    		
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(bufferinput, "jpg", os);
InputStream is = new ByteArrayInputStream(os.toByteArray());
image1.setImageStream(is);