Hi, I have this snippet in my program and it throws an error message like:
Error message:
Exception in thread “main” java.lang.Error: Unresolved compilation problems:
The constructor Image(Section) is undefined
The method add(Paragraph) in the type Paragraphs is not applicable for the arguments (Image)
The method getImageInfo() is undefined for the type Image
The method getImageInfo() is undefined for the type Image
My snippet:
// Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
// Create a section in the Pdf object
Section sec1 = pdf1.getSections().add();
// Create an image object in the section
com.aspose.pdf.Image img1 = new com.aspose.pdf.Image(sec1);
// Add image object into the Paragraphs collection of the section
sec1.getParagraphs().add(img1);
// Set the path of image file
img1.getImageInfo().setFile(strBarCodeImageSave);
img1.getImageInfo().setTitle(“JPEG image”);
// Save the Pdf
FileOutputStream out = new FileOutputStream(new File(strPdfDoc));
pdf1.save(out);
Why is it happening? Sorry my dumb post. I’m a total newbie at aspose.pdf
We have a license for aspose.Total