We are using gembox to convert eml to pdf. When an eml file has an html body and html tables what is the best way to ensure the HTML table is fitted to the page and if necessary the page orientation is adjusted to the landscape.
I am doing something similar for excel attachments:
foreach (var sheet in spreadsheet.Worksheets)
{
int columnCount = sheet.CalculateMaxUsedColumns();
double totalWidth = 0;
for (int i = 0; i < columnCount; i++)
{
var unitSize = Math.Round(sheet.Columns[i].GetWidth(LengthUnit.Inch));
totalWidth += unitSize;
}
sheet.PrintOptions.LeftMargin = 0;
sheet.PrintOptions.RightMargin = 0;
sheet.PrintOptions.TopMargin = 0;
sheet.PrintOptions.BottomMargin = 0;
sheet.PrintOptions.Portrait = !(totalWidth > 8.25);
sheet.PrintOptions.FitWorksheetWidthToPages = 1;
sheet.PrintOptions.FitWorksheetHeightToPages = 0;
}
I tried this code change and it seems to work however it dramatically slows down the conversion process. Is there a faster way to perform this operation?