Hi,
private Pdf pdfForInvoiceTest2() {
final Pdf pdf1 = new Pdf();
// Create a section in the Pdf object
final Section sec1 = pdf1.getSections().add();
// Create an image object in the section
final aspose.pdf.Image img1 = new aspose.pdf.Image();
// Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(img1);
// Specify the Image file type as JPEG
img1.getImageInfo().setImageFileType(ImageFileType.Jpeg);
// Set the path of image file
img1.getImageInfo().setFile("http://www.johnhpanos.com/jpeg.jpg");
// Set the path of image file
img1.getImageInfo().setTitle("JPEG image");
// Save the Pdf
return pdf1;
}
this method is called in a method here:
final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
try {
pdfForInvoiceTest2().save(outStream);
} catch (final Exception e) {
e.printStackTrace();
}
outStream.close();
return outStream.toByteArray();
The error I get is:
class com.aspose.ms.System.f: Invalid image handle in GetImageWidth method:-1
aspose.pdf.internal.eu.m(Unknown Source)
aspose.pdf.internal.kh.a(Unknown Source)
aspose.pdf.internal.kh.a(Unknown Source)
aspose.pdf.internal.ki.a(Unknown Source)
aspose.pdf.internal.la.a(Unknown Source)
aspose.pdf.xml.DocumentBase.a(Unknown Source)
aspose.pdf.internal.ka.a(Unknown Source)
aspose.pdf.Pdf.a(Unknown Source)
aspose.pdf.Pdf.save(Unknown Source)
Any idea what's going on? I can load images fine from a local file on my computer, but URL doesn't seem to work.
Thanks,
Chris