Good afternoon everyone,

Currently I am experiencing a problem with a flowdocument that I am trying to print. All the code is doing exactly what it is suppoed to do, but when I press the print button in my program, the page that comes out of the printer almost seems to be wordwrapped.
All in all the printed page seems to go no further than ~50 characters.

public void PrintIt()
        {
            PrintDialog PD = new PrintDialog();
            FlowDocument FDForPrinting = FD;

            FDForPrinting.PagePadding = new Thickness(50.0);

            IDocumentPaginatorSource DocPager = FDForPrinting;
            DocPager.DocumentPaginator.PageSize = new Size(PD.PrintableAreaWidth, PD.PrintableAreaHeight);
            PD.PrintDocument(DocPager.DocumentPaginator, "AutoChecklist Report");
        }

The PagePadding seems to make quite a difference, but that doesn't seem like the correct way.

Does anybody have a clue what might be causing this?

(P.S. the PageSize doesn't seem to make a difference, but I say it almost all of the similar pieces of code, so I tried that too)

A little further guesstimating has shown that a PagePadding as follows brings out the best result so far:

FDForPrinting.PagePadding = new Thickness(100.0, 100.0, 250.0, 100.0);

But this still doesn't utilize the full width of the page (by far. Maybe only 3/4).

The problem was fixed by doing

FDForPrinting.ColumnWidth = PD.PrintableAreaWidth;

Good luck for anyone else who has this problem!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.