I am trying to add an image which is on the web with below code with pdfbox library.
PDPage page = doc.getPage(0);
PDImageXObject pdImage = PDImageXObject.createFromFile("https://XXXXXX.png",doc);
PDPageContentStream contents = new PDPageContentStream(doc, page);
contents.drawImage(pdImage, 70, 250);
With above code I get below error.
javax.imageio.IIOException: Can't read input file! at javax.imageio.ImageIO.read(Unknown Source) at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromFileByExtension(PDImageXObject.java:223) at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.createFromFile(PDImageXObject.java:183)
But If I download this file in my local machine and then try with this code then it works fine. Please let me know if I miss something.
Thanks.