How to save the converted PDF into a stream c#.Net

Hi Team,
I am able to store the converted PDF into local disk. But, I want to save the file into a stream. I don’t find any overloaded convert methods of the converter class to do so.

I have tried below:
converter.Convert(() => new MemoryStream(), convertedStream => convertedStream.CopyTo(outputStream), converterOptions);

but getting the error
“Delegate ‘Action<Stream, string>’ does not take 1 argument”.

We also have groupdocs.total license. Kindly advise how to store the converted PDF into a stream.

1 Like

@ABC123gdforum

Please take a look at this documentation article - Save file to stream.

@atir.tahir
I already went through that article.
It contains the code which is saving the converted file into local disk first and then converting the file stored in the local disk into stream using file functions. This is not useful in our case. We directly want to store the converted file into stream. Kindly help.

1 Like

@ABC123gdforum

Please use following syntax:

converter.Convert(() => new MemoryStream(), (convertedStream, sourceFileName) => convertedStream.CopyTo(outputStream), converterOptions);

or

converter.Convert(() => new MemoryStream(), (convertedStream, _) => convertedStream.CopyTo(outputStream), converterOptions);
1 Like