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

Free Support Forum - aspose.com

Issue while converting pdf to images when using s3 as storage


I am facing an issue while converting pdf to images when my storage is mounted on s3 disk.

Please see the code that is creating 0 byte file size.

try {
pdfDocument = new Document(inputStream);
logger.info(“PDF page count of document for image extraction : {}”,pdfDocument.getPages().size());
for (int pageCount = 1; pageCount <= pdfDocument.getPages().size(); pageCount++) {
filePath = imageDirectoryPath /+ “/”/ + pageCount + “.” + formatName;
imageStream = new java.io.FileOutputStream(filePath);
Resolution resolution = new Resolution(100);
PngDevice pngDevice = new PngDevice(resolution);
pngDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);

This was working fine when my storage was not mounted on s3 disk. But when we changed our disk to s3 , it started creating 0 byte images.

Also , when i changed from stream to actual file path in pngDevice.process api , it started working.
pngDevice.process(pdfDocument.getPages().get_Item(pageCount), filePath)

Can you please tell me why is this behaving like this.


Thanks for contacting support.

Would you please confirm if you are referring to Amazon Disk Service i.e. S3? Also, please share your sample PDF document with us. We will further investigate the scenario in details and share our feedback with you.

Hi Asad,

Thanks for the reply. Yes I am referring to Amazon Disk Service i.e. S3 .Also this is happening with all pdf documents.


It seems like your application does not have write access/permission to the disk. Please make sure that it does by saving simple files without using Aspose.PDF API methods. In case you still experience the issue only with Aspose.PDF for Java methods, please share details about your application type and JDK version. We will further proceed to help you accordingly.

Hi Asad,

Apologies for the late reply.

The application has complete access to the disk. Because when i use the other api in which i pass the path rather than string , it works. With stream , it does not work.


Thanks for getting back to us.

It seems environment specific issue and we need to investigate it in specific environment. However, please provide sample console application which demonstrates complete routine of your program along with sample document(s). It would help us testing the scenario and investigate it accordingly.