Using Word.Net to stream docs out of a database

Hi Guys
Have documents stored as images in MSSQL2008 on Win2008 server.
I would like to pass a byte array containing a single MSWord.docx file to my Aspose Word component, have the aspose component save the document as a new pdf file allowing me to then stream the pdf to a client’s PC.
I tried this but could not make it work without having to save the MSWord.docx file to hard disc on the server first, I would like to avoid this.
Is this possible using the Aspose.Word .net component to do this without the save to hard disc ?
Many thanks
Kevin

Hi Kevin,

Thank you for your interest in Aspose.Words. Sure, it is possible. I think the following article could help you to achieve what you need:
https://docs.aspose.com/words/net/serialize-and-work-with-a-document-in-a-database/
Please let me know if you need more assistance, I will be glad to help you.
Best regards,

Hi Alexey
I am ok up to the final stage, I am having trouble understanding how to use the aspose word object to perform a SaveAs and convert the original MSWord.docx file to a new pdf document, and save the new pdf file to a stream without persisting to hard disc.
The idea is to put the aspose component on a server and rather than deploy to each windows client PC.
Many thanks for your help.
Kevin

Dim doc As New Document(newStream)
' Store the document to the specified directory.
fileName = fileName.Insert(fileName.LastIndexOf("."), " from DB")
doc.Save(path & fileName)

Hi

Thanks for your inquiry. You can use the following simple code to save document as PDF to stream:

// Open source docuemnt from file or stream
Document doc = new Document(@"C:\Temp\in.doc");
// Create MemoryStrema where we will save output PDF.
MemoryStream pdfStream = new MemoryStream();
// Save output document as PDF to stream.
doc.Save(pdfStream, SaveFormat.Pdf);

Best regards,