Hello,
I'm getting the "memorystream is not expandable" error when I get to line 3 in the below code snippet and I'm not sure how to get past this error.
MemoryStream mstream = new MemoryStream(list[i].AttachmentData.ToArray());
Aspose.Words.Document doc = new Aspose.Words.Document(mstream);
doc.Save(mstream, Aspose.Words.SaveFormat.Pdf);
pdfStreams1[i] = mstream;
Thank you
Tad
Hi Tad,
Thanks for your inquiry. Please use MemoryStream.Position as shown below.
Aspose.Words.Document doc = new Aspose.Words.Document(mstream);
mstream.Position
= 0;
//mstream.Seek(0,
SeekOrigin.Begin);
//mstream
= new MemoryStream();
doc.Save(mstream,
Aspose.Words.SaveFormat.Pdf);
Hope this helps you. Please let us know if you have any more queries.
Hi Tahir,
Thank you for your reply. While I was waiting for an answer, I tried a couple of other things and the code below worked for me.
I thought I’d post it just in case it might come in handy for someone else.
Thank you
Tad
var mstream = new MemoryStream();
mstream.Write(list[i].AttachmentData.ToArray(), 0, list[i].AttachmentData.Length);
Aspose.Words.Document doc = new Aspose.Words.Document(mstream);
doc.Save(mstream, Aspose.Words.SaveFormat.Pdf);
pdfStreams[i] = mstream;
Hi Tad,
Thanks for sharing the code. We always appreciate positive feedback from our customers. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.