I am trying to convert HTML to a PDF document with 0.25" margins. The left and right margins are being set correctly, but the top and bottom margins remain 0.5". My code is below, a screenshot of the generated PDF is attached.
StringBuilder sb = new StringBuilder();
foreach (string row in data)
sb.AppendLine(row);
HtmlFormatProvider provider = new HtmlFormatProvider();
RadFlowDocument html = provider.Import(sb.ToString());
foreach (Section section in html.Sections)
{
section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(24, 24, 24, 24);
// Code snippet from function that adds header inserted below
Table table = header.Blocks.AddTable();
Border border = new Border(1, BorderStyle.Single, new ThemableColor(Colors.Black));
table.Borders = new TableBorders(border);
TableRow row1 = table.Rows.AddTableRow();
row1.Height = new TableRowHeight(HeightType.Exact, 30);
TableCell Title = row1.Cells.AddTableCell();
Paragraph pTitle = Title.Blocks.AddParagraph();
Run rTitle = pTitle.Inlines.AddRun(FormName);
Title.PreferredWidth = Inches(3.99);
Title.Shading.BackgroundColor = gray;
Title.VerticalAlignment = VerticalAlignment.Center;
rTitle.FontWeight = FontWeights.Bold;
rTitle.FontSize = 16;
// Call to similar code for adding footer
}
PdfFormatProvider pdf = new PdfFormatProvider();
return pdf.Export(html);
Thanks in advance for the help.
Darwin Pinder