Hi Good day,
How are you?
We are having some production issue while converting certain .jpg files to PDF.
Following is the error that we are getting in our Service logs.
Error message: Image top or bottom margin is too large 0,0 image file:/var/spool/pdfconvert/aspose/1427704633078_1_3.JPG. Error cause: null
try {Pdf pdf1 = new Pdf();
// Create a section in the Pdf object
Section sec1 = pdf1.getSections().add();
// Create an image object in the section
aspose.pdf.Image img1 = new aspose.pdf.Image(sec1);
// Add image object into the Paragraphs collection of the section
sec1.isLandscape(true);//added to resolve some formatting issue
sec1.getParagraphs().add(img1);
// Set the path of image file
img1.getImageInfo().setFile(inFilepath);
// Save the Pdf
pdf1.save(pdfFilepath);
LOG.info(" Converted Image To Pdf by ASPOSE Successfully " );
}catch (Exception e) {
LOG.error("Failed to convert Image to PDF... Error message: "+e.getMessage()+". Error cause: "+e.getCause());
throw new XPdfConvert(String.format(
"message=\"Failed to convert Image file To PDF '%s'\"", inFilepath),e);
}
}
Pls find the samples attached which are failed.
Currently we are using
'aspose.pdf-9.1.0.jar'
as we are having some formatting issues with old version "aspose.pdf-3.0.1.jdk16.jar" few months
so we have deployed new version of 'aspose.pdf-9.1.0.jar' with some extra logic added to code.
sec1.isLandscape(true);//added to resolve some formatting issue.
which means,while converting bigger images the result pdf is coming in two or more pages for one image and which is not really looking good.
After deploying new version and above logic highlighted solved the issue,
but we are getting new issue, with certain jpg files as per attached samples with the following
Error:
Error message: Image top or bottom margin is too large 0,0 image
Your response,will be appreciated,
Regards,
Prasad
Prasad