Email body with tab chacters convert to pdf issue

We have a .msg to be converted to PDF.
The body contains a sentence, in front of that sentence contains 15+ tab characters.
We are converting this msg file to pdf using below logic

Ligic#1:

 Aspose.Words.Document document = null;
    var message = Aspose.Email.MailMessage.Load(inputPath);
    
    using (var msgStream = new MemoryStream())
    {
        message.Save(msgStream, Aspose.Email.SaveOptions.DefaultMhtml);
        msgStream.Position = 0;
        var options = new Aspose.Words.Loading.LoadOptions();
        options.LoadFormat = Aspose.Words.LoadFormat.Mhtml;
        document = new Aspose.Words.Document(msgStream, options);

        document.Save(outputPDF, new Aspose.Words.Saving.PdfSaveOptions());

    }

Find the attached Original msg file content:
test-1 with tabs.zip (18.7 KB)

With above logic-1 convert to pdf:
Aspose_MsgToPdf_d20f5.pdf (56.0 KB)

Logic#2:

 Aspose.Words.Document document = null;
    var message = Aspose.Email.MailMessage.Load(inputPath);
    
    using (var msgStream = new MemoryStream())
    {
        message.Save(msgStream, Aspose.Email.SaveOptions.DefaultMhtml);
        msgStream.Position = 0;
        var options = new Aspose.Words.Loading.LoadOptions();
        options.LoadFormat = Aspose.Words.LoadFormat.Mhtml;
        document = new Aspose.Words.Document(msgStream, options);
        foreach (Aspose.Words.Section section in document.Sections)
        {
            var pageSetup = section.PageSetup;
            pageSetup.Orientation = Aspose.Words.Orientation.Portrait;

            pageSetup.TopMargin = 20;
            pageSetup.BottomMargin = 10;
            pageSetup.LeftMargin = 10;
            pageSetup.RightMargin = 10;

            pageSetup.PageWidth = 842; 
            pageSetup.PageHeight = 1191;
        }
        document.Save(outputPDF, new Aspose.Words.Saving.PdfSaveOptions());
    }

We tried below to set the potrait & width
It is extending to support few more tab characters → but missing the content after 25 tabls

With above logic-2 convert to pdf:
Convert_MSG2PDF_Logic-2.pdf (55.5 KB)

How to fit the total content of email body within the pdf width.

@venkatmallu Could you please zip and attach the problematic input MSG file here for testing? We will check the issue and provide you more information.

Hi Alex,
I’ve updated the screenshot with Original test file in zip

test-1 with tabs.zip (18.7 KB)

Attaching here as well

@venkatmallu There are simply not enough space on the page. You can increase paper size to get the desired output:

Aspose.Email.MailMessage msg = Aspose.Email.MailMessage.Load(@"C:\Temp\in.msg");
msg.Save(@"C:\Temp\tmp.mhtml", Aspose.Email.SaveOptions.DefaultMhtml);
Aspose.Words.Document doc = new Aspose.Words.Document(@"C:\Temp\tmp.mhtml");
doc.FirstSection.PageSetup.PaperSize = PaperSize.A3;
doc.FirstSection.PageSetup.Orientation = Orientation.Landscape;
doc.Save(@"C:\Temp\out.pdf");

out.pdf (55.3 KB)

Hi @alexey.noskov,

If the number of tabs increases still the issue coming

test-2 with up to max tabs.zip (86.7 KB)

Attached the msg file and converted pdf file

@venkatmallu Could you please elaborate what is the expected behavior you would like to see? You should note that Aspose.Words is designed to work with MS Word document. In your case the input is MHTML, Aspose.Words in most cases mimics MS Word behavior when work with HTML documents. Also, you can increase number of tabs perpetually in HTML, but you cannot perpetually increase page size. In MS Word the maximum page size is limited to 1584pt. The same limit is used by Aspose.Words.