We're sorry Aspose doesn't work properply without JavaScript enabled.

# Table is getting cut while converting MSG to PDF

Any update here, even we are having similar issues where table is getting cut while converting MSG to PDF.

@hardikshah_cfirst Could you please attach your source and output documents here for testing? We will check the issue and provide you more information.

My colleague has created new ticket already, and the reference of that ticket is as below.

https://forum.aspose.com/t/msg-to-pdf-tables-does-not-autofit-as-per-width-of-page-aspose-email/257187

Thanks
Hardik

@hardikshah_cfirst Thank you for additional information. The tables in your mail message are simply too wide to fit the page. You can change the page dimensions to make them fit. For example see the following code:

Aspose.Email.MailMessage eml = Aspose.Email.MailMessage.Load(@"C:\Temp\in.msg");
eml.Save(@"C:\Temp\tmp.mhtml", Aspose.Email.MhtSaveOptions.DefaultMhtml);

Document doc = new Document(@"C:\Temp\tmp.mhtml");
// Chnage page orientation to landscape. and make it bigget to fit the table.
doc.FirstSection.PageSetup.Orientation = Orientation.Landscape;
doc.FirstSection.PageSetup.PaperSize = Aspose.Words.PaperSize.A3;

doc.Save(@"C:\Temp\out.pdf");


out.pdf (39.5 KB)

We would like to have this in A4/Letter so that we can combine them with other documents in A4/Letter size. If we try doing that, table is getting cut,

Thanks
Hardik

@hardikshah_cfirst Alternatively you can auto fit the tables in the document to window. But since the tables in your document are too wide they will look not quite acurate:

Aspose.Email.MailMessage eml = Aspose.Email.MailMessage.Load(@"C:\Temp\in.msg");
eml.Save(@"C:\Temp\tmp.mhtml", Aspose.Email.MhtSaveOptions.DefaultMhtml);

Document doc = new Document(@"C:\Temp\tmp.mhtml");

// Autofit the table to window.
foreach (Table t in doc.FirstSection.Body.Tables)
t.AutoFit(AutoFitBehavior.AutoFitToWindow);

doc.Save(@"C:\Temp\out.pdf");


out.pdf (40.9 KB)