How can I write the PDF file to a memory Stream



I am new to using Aspose.PDF.Form

Can I get some sample code where the PDF file is written to a memory stream object.

I am currently using this code -

dim pdfStream as MemoryStream
dim form as form = new form(filepath, pdfStream)

’ fill the fields

’Save form

It throws an exception when it tries to save the form.

Am I missing some code before saving the form.

Any help will be highly appreciated.




Dear Vikas,

Thanks for considering Aspose.Pdf.Form.
1) Your code seems right. But what exception did it throw?

2) If you want to read the memory stream again after “form.Save()”, remember that you should set the stream at 0 position like this: pdfStream.Position = 0

3) If any more question, could you attach your pdf and code?

Best regards.


I think the problem is I am doing the code in a method which returns a memory stream object back to another method.

I’ll get the code and post it here.