I am having issue while converting .eml and .pptx to PDF using memory stream.
The same code works just fine for .png and *.html.
I just replace the LoadOptions based on the file type.
See below for the LoadOptions I am using.
new EmailLoadOptions
{
Format = EmailFileType.Eml,
ConvertOwned = true,
DisplayHeader = true
}
new PresentationLoadOptions
{
Format = PresentationFileType.Pptx
}
Hello @vanderley.correia ,
Thank you for reaching out.
To better understand and resolve the issue, we kindly ask you to provide:
- the full code snippet used for the conversion,
- the version of GroupDocs.Conversion you are using,
- and the specific files (if the issue appears only with some of them).
This information will help us reproduce the issue locally and assist you more efficiently.
Hi team,
See below:
Code here: GroupDocsConverter.zip (1.4 KB)
Version: 25.3.0
Files:
Files.zip (455.9 KB)
@vanderley.correia ,
Thank you for providing the detailed information.
We will get back to you after completing our further investigation.
Hello @vanderley.correia ,
We apologize for the delay.
We have reviewed your document conversion example, and it appears to be incorrect.
The SavePageContext
and SaveContext
overloads are intended for use when a FileStream
is provided.
In your case, since you want to obtain the converted document as a stream and handle it as needed, we recommend using the ConvertedContext
overload instead.
Please refer to the sample code below:
var outputStream = new MemoryStream();
var fileName = "PresentationTest.pptx";
using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
using (var converter = new GroupDocs.Conversion.Converter(() => fileStream, GetLoadFunction(fileName)))
{
var convertOptions = new PdfConvertOptions();
converter.Convert(
convertOptions,
(ConvertedContext convertedContext) =>
{
convertedContext.ConvertedStream.CopyTo(outputStream);
convertedContext.ConvertedStream.Dispose();
});
}
}
If you have any further questions, please don’t hesitate to reach out to us.
Excellent. It worked like a charm.
Thank you so much for your help.
@vanderley.correia ,
Always happy to help. Let us know if you have any other questions.