Free Support Forum - aspose.com

BMP files faling while converting to pdf

Hi,

when I am converting a bmp file to a pdf I am getting the foloowing exception :

java.lang.RuntimeException: Can't open image file C:\ziptest\Image0654.bmp

at aspose.pdf.figure.Abc.a(SourceFile:138)

at aspose.pdf.xml.Abg.a(SourceFile:252)

at aspose.pdf.xml.Abg.a(SourceFile:765)

at aspose.pdf.xml.Abh.a(SourceFile:579)

at aspose.pdf.xml.Aca.a(SourceFile:771)

at aspose.pdf.xml.Aaq.a(SourceFile:105)

at aspose.pdf.xml.Aaz.a(SourceFile:112)

at aspose.pdf.Pdf.save(SourceFile:911)

I am using Java 2.7.0 and PDF kit 3.7.0.

Code sample : (attaching the sample bmp file)

Pdf pdfImage = new Pdf();

Section sec = pdfImage.getSections().add();

aspose.pdf.Image img = new aspose.pdf.Image(sec);

sec.getParagraphs().add(img);

img.getImageInfo().setFile(fileName);

pdfImage.save(pdfFileName);

Hello Sriman,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for Java 2.9.0 and as per my observations, when I have tried adding the image file that you have shared into PDF document, I am getting an error message. For the sake of correction, I have logged it as PDFJAVA-29845 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. We are sorry for this inconvenience.

Besides this, I have tried adding one of my sample BMP image file and the PDF document is properly being generated. Please take a look over the sample Image file and the resultant PDF that I have generated.

[Java]

//Instantiate Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
aspose.pdf.Section sec1 = pdf1.getSections().add();
aspose.pdf.Image img = new aspose.pdf.Image(sec1);
sec1.getParagraphs().add(img);
// specify the image file path
img.getImageInfo().setFile("D:/pdftest/test/linux.bmp");
// specify the image file type information
img.getImageInfo().setImageFileType(ImageFileType.Bmp);
// save the resultant PDF
pdf1.save("D:/pdftest/test/test.pdf");

The issues you have found earlier (filed as 29845 ) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.