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

Free Support Forum - aspose.com

Document Conversion and dispose()

Given the following snippet:

Document d = new Document(InputStream);
try(OutputStream os = …) {
d.save(os, …SaveOptions)

Does d.save() close the InputStream?
Does d.close() close the InputStream?
Does d.dispose() close the InputStream?

I assume it is my responsibility to close the InputStream, but the documentation doesn’t indicate one way or the other, and none of the examples suggest any kind of resource cleanup.


Hi Damon,

Thanks for contacting support.

The Document.save(…) method saves the resultant PDF file and does not close the InputStream instance. Furthermore, the Document.Dispose(…) disposes com.aspose.pdf.Document instances and any resources currently being used by this object. However if you are using any Stream instances, once they are utilized, it is recommended that you close them individually.