I have a simple goal: I want that a new Block added to my FlowDoc is always in the next row and if the first page is full, then skip to the next page (> Row 59). But if I run my code, the document seems to be divided into two columns and Row 60 appears on the first page (right) and not on the second (what I want to). Can anyone help me with this? Thank’s a lot.Screenshot
private void Button_Click(object sender, RoutedEventArgs e)
{
FlowDocument flowDoc = new();
flowDoc.FontFamily = new FontFamily("Arial");
flowDoc.FontSize = 12;
flowDoc.PageWidth = 755;
flowDoc.PageHeight = 1150;
flowDoc.PagePadding = new Thickness(60, 50, 60, 50);
flowDoc.LineHeight = 4;
for (int i = 0; i < 100; i++)
{
flowDoc.Blocks.Add(new Paragraph(new Run($"Row {i + 1}")));
}
PrintDialog pd = new();
if (pd.ShowDialog() == true)
{
IDocumentPaginatorSource idpSource = flowDoc;
pd.PrintDocument(idpSource.DocumentPaginator, "Print Page");
}
}
New contributor
Rainer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.