Open pdf with null password closes stream

var 11.9.0.0

string password = "xxxx";
strm.Seek(0, SeekOrigin.Begin);
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(strm, password);

doc is created but stream is closed


strm.Seek(0, SeekOrigin.Begin);
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(strm,);

does not close the stream.doc is created but stream is NOT closed



am i doing something wrong or maybe this behavior is intentional?


Thanks
Tom

Hi Thomas,


Thanks for contacting support.

tack0000:
string password = “xxxx”;
strm.Seek(0, SeekOrigin.Begin);
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(strm, password);

doc is created but stream is closed

Please note that the constructor of Document Class with overloads i.e Stream, Password is provided to initialize/open a PDF document which is already password protected. In order to create a document, you do not need to give the password in the overloads. Please check the “Set Privileges, Encrypt and Decrypt PDF file” section in API documentation to make a document password protected.

tack0000:
var 11.9.0.0

I am afraid that you are using a quite old version of the API. It is always recommended to use the latest version of the API which is 17.2.0.0. Latest version of Aspose.Pdf for .NET can be downloaded from here.

Moreover, In case you are using an existing document which is password protected we will really appreciate if you please share it so that we can test the scenario in our environment and get back to you accordingly.


Best Regards,