We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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

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());
pdfOptions.setPageSize(new SizeF((int) width, (int) height));
image.save(stream, pdfOptions);

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



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.