PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ .NET Generating PDF into MemoryStream instead of the file Re: Re: .NET Generating PDF into MemoryStream instead of the file

#28207

This is a common problem with MemoryStream usage in code ported from java.

Try this workaround (it works fine for me):
http://connect.microsoft.com/VisualStudio/feedback/details/164680/streamwriter-incorrectly-disposes-underlying-stream
Basically decorate the underlying memory stream (the argument to StreamWriter) as:
streamWriter(new NonDisposingStreamDecorator(memoryStream))

Alex