Headers are disappearing while convertig from Email to PDF

Hello, when converting Email to PDF, the Headers do not appear in the PDF file. I am using Aspose Email 23.12. I was using Aspose.Email 6.0.0 before. Everything was OK.

Sample Code is below. Am I forgetting any settings?

MailMessage document;

public void convert(OutputStream outputStream) {

MhtSaveOptions so = new MhtSaveOptions();
so.setMhtFormatOptions(MhtFormatOptions.WriteOutlineAttachments);

so.getRenderingHeaders().add("From");
so.getRenderingHeaders().add("Date");
so.getRenderingHeaders().add("Reply-To");
so.getRenderingHeaders().add("To");
so.getRenderingHeaders().add("Subject");

// convert email to pdf
ByteArrayOutputStream tmpStream = new ByteArrayOutputStream();
ByteArrayOutputStream emailAsPdfStream = new ByteArrayOutputStream();
this.document.save(tmpStream, so);

LoadOptions loadOptions = new LoadOptions();
loadOptions.setLoadFormat(com.aspose.words.LoadFormat.MHTML);
com.aspose.words.Document word = new Document(new ByteArrayInputStream(tmpStream.toByteArray()), loadOptions);

word.save(emailAsPdfStream, com.aspose.words.SaveFormat.PDF);
com.aspose.pdf.Document pdf = new com.aspose.pdf.Document(new ByteArrayInputStream(emailAsPdfStream.toByteArray()));

pdf.save(outputStream);
}

Hello @osmanolgun,

Thank you for contacting the support forum.
To display headers, you should specify the WriteHeader option:

so.setMhtFormatOptions(
MhtFormatOptions.WriteHeader | MhtFormatOptions.WriteOutlineAttachments);

thank you too. I will try it now. I have one more question:

Do I need to use the following ? Or are they automatically generated?

so.getRenderingHeaders().add("From");
so.getRenderingHeaders().add("Date");
so.getRenderingHeaders().add("Reply-To");
so.getRenderingHeaders().add("To");
so.getRenderingHeaders().add("Subject");

In general, you can ignore this, except if you only need to display certain fields.