Set default font for the PDF document to avoid specifying styling for every text fragment in Aspose.PDF for .NET
i am constructing a PDF document for a report.
the very first thing i do is to
pdf = new Pdf();
pdf.DefaultFontName = FontName; //“Arial” in this case
i then go on to build up the report and do things such as
Aspose.Pdf.Table tbl = new Aspose.Pdf.Table();
tbl.ColumnWidths = ColumnWidths;
tbl.DefaultCellPadding = something…;
tbl.ImportDataTable(dt, true, 0, 0, dt.Rows.Count, dt.Columns.Count);
foreach (Aspose.Pdf.Row rr in tbl.Rows)
rr.BackgroundColor = lb;
odd = !odd;
and things like this
TextInfo boldCol = new TextInfo();
boldCol.Alignment = AlignmentType.Left;
boldCol.IsTrueTypeFontBold = true;
boldCol.FontSize = 10;
however when i do the above whatever element i have styled loses the font set right at the beginning.
surely i dont have to set the font as part of every bit of styling i add to an element?
so the table is all in one font, but as i format the headings to be bold and some are then left aligned … things like that, whenever i do this, those elements revert back to time roman font.
could someone explain how to avoid this pelase
Can you please share the complete code snippet so that we can test the scenario at our end. We apologize for your inconvenience.
PS, I have tried regenerating the code at my end but I am afraid I am unable to replicate the issue at my end.