Free Support Forum - aspose.com

BMP, JPEG ,tiff and gif could not able to set pdfa-2 save option in ASPOSE JAVA

Hi
I am trying to convert BMP, JPEG ,tiff and gif files to pdf , but I could not able to add pdf save option to it.
my expectation is need to convert BMP, JPEG ,tiff and gif to pdf A-2 and save this pdfa-2 as a stream.
Can you help us providing code in Aspose java.

Please find my current code :

com.aspose.imaging.Image image = com.aspose.imaging.Image.load(docStream);
try {
PdfOptions pdfOptions = new PdfOptions();
double width = image.getWidth() * (72 / ((RasterImage) image).getHorizontalResolution());
double height = image.getHeight() * (72 / ((RasterImage) image).getVerticalResolution());
System.out.println(width);
System.out.println(height);
pdfOptions.setPageSize(new SizeF((int) width, (int) height));
image.save(stream, pdfOptions);

			inputStream = new ByteArrayInputStream(stream.toByteArray()); 

Thanks
Siva

@ssamidis

I suggest you to please visit this documentation link for your convenience to export raster images like (Jpeg and PNG) to PDF. Please also visit this API reference guide link for your convenience. If there is still an issue then please share what issue you are facing on your end along with source file.