I have long listbox with around 250+ items. It is wrapped with some labels inside a Grid
which is again wrapped inside a ScrollViewer
. I am using the following code to print the contents of my grid.
PrintDialog printDlg = new PrintDialog();
printDlg.PrintVisual(grid1, "Grid Printing.");
But, it prints all the 250+ items on a single page thereby making everything too small. Why does it not automatically resize automatically? What can I do to achieve proper scaling and pagination?
Any help is highly appreciated. Thanks.
Edit: Just added the following code and now the size is fine.
Size pageSize = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
// sizing of the element.
gridinner.Measure(pageSize);
gridinner.Arrange(new Rect(5, 5, pageSize.Width, pageSize.Height));
But it still prints the content on the first page.