PDFs are created from report template which contains text fields having left, height, width and top properties:
Paragraph does not have position and size. So text is added to paragraph inside TextFrame. Paragraph contains variable number of lines and has variable height. Page break should inserted if top position + height is greater that printable area in page.
If paragraph is added to textframe and paragraph height is extended to two lines, line in page is only partially visible sometimes.
Example is in https://github.com/empira/PDFsharp/files/12776630/actual.behaviour.pdf
To reproduce run code in MigraDoc template:
static Document CreateDocument()
{
// Create a new MigraDoc document.
var document = new Document { };
// Add a section to the document.
var section = document.AddSection();
section.PageSetup.BottomMargin = 0;
section.PageSetup.TopMargin = 0;
for (int p = 1; p < 100; p++)
{
var textFrame = section.AddTextFrame();
textFrame.RelativeVertical = RelativeVertical.Line;
textFrame.WrapFormat.DistanceTop = Unit.FromCentimeter(0.11);
textFrame.Height = Unit.FromCentimeter(0.47);
var paragraph = textFrame.AddParagraph();
paragraph.Format.Font.Name = "Times New Roman";
paragraph.Format.Font.Size = 10;
paragraph.AddText("Maksekorraldus 123456");
paragraph.Format.SpaceBefore = 0;
paragraph.Format.SpaceAfter = 0;
}
return document;
}
Full VS solution is in https://github.com/empira/PDFsharp/files/12776629/texttruncatedinendofpage.zip
How to make all lines fully visible? In real application paragraph height is not known and Migradoc does not provide method to get paragraph height. So textframe height cannot increased by code.
Using PDFsharp-MigraDoc 6.0.0-preview-3
Textframes do not break to the next page, this is by design.
Callers must ensure that a textframe fits onto the page.
For normal text, it is recommend to have the text in the body of the section or in a table.
Note that table cells will not break across pages.
Tables will break at cell boundaries.
Paragraphs in the body will break at line boundaries.