Converting msg to pdf with defaut PdfConvertOptions settings renders wrong page ratio (very high page), but setting PageSize to A4 renders a blank Pdf page (the file is not empty because the size is not 0ko). We are using dotnet 6 and GroupDocs.Conversion 24.3.0. Here is the code snippet:
ConverterSettings converterSettings = new()
{
Logger = new GroupDocsLogger(_logger)
};
_formatFichierCible = request.FormatCible;
using Stream sourceStream = new MemoryStream(request.FichierSource.Contenu);
using MemoryStream outputStream = new MemoryStream();
using var converter = new Converter(
() => sourceStream,
(sourceType) => new EmailLoadOptions
{
ConvertOwner = true,
ConvertOwned = false,
Depth = 0
},
() => converterSettings);
int index = 0;
converter.Convert(
() =>
{
index++;
return (index == 1) ? outputStream : new MemoryStream();
},
(sourceFileName, targetFileType, convertedFileStream) =>
{
_logger.LogDebug($"Le document {sourceFileName} a été converti dans le format {targetFileType}");
},
// Provider des options de conversion
(sourceDocumentName, sourceDocumentType) => new PdfConvertOptions()
{
Format = PdfFileType.Pdf,
PageSize = PageSize.A4
});
msg.zip (443,1 Ko)