I am getting error while trying to creating a new pdf from MemoryStream. Below is the code I am using
So, I am getting the memorystream of the file which is on the database as a blob column. Then I am trying to create a new PDF, writing content from memorystream to it and save it on a physical location.
Public string CreatePdfFromMemoryStream()
{
string filePath = “C:\tempFile\file1.pdf”;
MemoryStream stream = DS.GetDocFileFromDB();
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf(stream );
pdf1.Save(filePath);
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf(stream );
pdf1.Save(filePath);
stream .Close();
return filePath;
}
I am getting the error where it says use “close” instead of “save”.
Please suggest.
Thank you