Hello, I am using aspose.pdf.dll version 9.7.0.0 in a .Net MVC v4 environment.
I am reading data into an Aspose Document from a file using a FileStream. Once the file has been read into the new memorystream object, I then remove the open document password requirement using the document.decrypt method. After the password has been removed, I then save the document to a MemoryStream and then save that memory stream to another file.
The output file being saved to the filesystem is throwing an adobe error 118 when opened in Acrobat Reader.
I have attached sample files for you to test with and source code samples.
Test5.pdf is my source file, test5b.pdf is the processed file throwing the error 118.
Please advise.
Sample Code:
string decryptPassword = “open”;
ms = new MemoryStream();
FileStream inFile = new FileStream(@“c:\users\myuser\desktop\test5.pdf”, FileMode.Open);
inFile.CopyTo(ms);<span style="color:green;">// Open the PDF document with the password</span> Aspose.Pdf.<span style="color:#2b91af;">Document</span> currentDoc = <span style="color:blue;">new</span> Aspose.Pdf.<span style="color:#2b91af;">Document</span>(ms, decryptPassword); currentDoc.Decrypt(); currentDoc.Save(ms); <span style="color:#2b91af;">FileStream</span> outFile = <span style="color:blue;">new</span> <span style="color:#2b91af;">FileStream</span>(<span style="color:#a31515;">@"c:\users\myuser\desktop\test5b.pdf"</span>, <span style="color:#2b91af;">FileMode</span>.Create); ms.CopyTo(outFile); inFile.Close(); outFile.Close(); ms.Close();</pre></div><div><br></div><div>Thank you in advance!</div><div>Rob</div><div><br></div><div><br></div><div><br></div>