Open PatrykPlewaOfficial opened 4 years ago
It may be an issue that has been fixed in PdfSharp after MigraDocCore has branched from MigraDoc.NET. Or it may be incorrect font handling.
Previously worked on PdfSharp
assembly version 1.50.4589.0
My current workaround for this is:
table.BottomPadding = Unit.FromMillimeter(1.6);
Experiencing the same issue. I've drawn borders around the paragraph and it's clear that the font is simply simply being calculated too high:
I am also experience the same issue.
@PatrykPlewaOfficial
I ran the code above, on PDFSharpCore 1.2.19 MigraDocCore.Rendering 0.1.3 and it appears to match the expected?
Perhaps has been fixed? If so consider closing the issue
[Fact]
public void VerifyMarginPadding()
{
var document = new Document();
var section = document.AddSection();
var table = section.AddTable();
table.Borders.Width = 0.25;
for (var i = 0; i < 4; i++)
{
var column = table.AddColumn();
column.Format.Alignment = ParagraphAlignment.Center;
}
var row = table.AddRow();
row.HeadingFormat = false;
row.Format.Alignment = ParagraphAlignment.Center;
row.Format.Font.Bold = false;
row.Cells[0].AddParagraph("Payment Date From:");
row.Cells[0].Format.Font.Bold = true;
row = table.AddRow();
row.HeadingFormat = false;
row.Format.Alignment = ParagraphAlignment.Center;
row.Format.Font.Bold = false;
row.Cells[0].AddParagraph("Entered by");
row.Cells[0].Format.Font.Bold = true;
row = table.AddRow();
row.HeadingFormat = false;
row.Format.Alignment = ParagraphAlignment.Center;
row.Format.Font.Bold = false;
row.Cells[0].AddParagraph("Data sorted by");
row.Cells[0].Format.Font.Bold = true;
// Create a renderer for the MigraDoc document.
const bool unicode = false;
var pdfRenderer = new PdfDocumentRenderer(unicode)
{
Document = document
};
pdfRenderer.RenderDocument();
pdfRenderer.PdfDocument.Save("C:\\temp\\table.pdf");
}
After migration to
PdfSharpCore / MigraDocCore
I have noticed that text do no fit anymore in table cell. The code stayed untouched.As you can see,
MigraDocCore
generated PDF document has some extra top cell spacing/margin/distance, which results in pruning some part of text with cell border.Project:
Repro Code:
I don't know if there is some kind of breaking change which adds a default top margin or it's an issue.