Page 1 of 1

BullZip prints 2 columns. C# WPF RichTextBox plain text

Posted: Wed Jan 04, 2023 2:16 pm
by rupertreynolds
Advice, please? I did search StackOverflow and this forum before asking.

I load a plain ASCII text file into RichTextBox, set a small fixed font size, then print. BullZip is installed in Win64 with default settings.

BullZip always uses 2 columns per page, when the RichTextBox only has one column, with short lines. This happens even if the font size is smaller (example Consola mono 8), making each line of text much less than page width. I also tried entering text by hand, explicitly using <Return> at the end of each short line.

Example code below. It creates a copy of the text first, to work-around the "RichTextBox displays as blank after print" problem :-

private void MnuFilePr_Click(object sender, RoutedEventArgs e)
}
PrintDialog pd = new PrintDialog();
if (pd.ShowDialog() == true)
{
MemoryStream stream = new MemoryStream();
TextRange sourceDocument = new TextRange(rtbMain.Document.ContentStart, rtbMain.Document.ContentEnd);
sourceDocument.Save(stream, DataFormats.Xaml);
FlowDocument flowDocumentCopy = new FlowDocument();
TextRange copyDocumentRange = new TextRange(flowDocumentCopy.ContentStart, flowDocumentCopy.ContentEnd);
copyDocumentRange.Load(stream, DataFormats.Xaml);

pd.PrintDocument(((IDocumentPaginatorSource)flowDocumentCopy).DocumentPaginator,
"Printing Richtextbox Content");
}
}

Any thoughts on what I'm doing wrong, please?

Roops

Re: BullZip prints 2 columns. C# WPF RichTextBox plain text

Posted: Wed Jan 04, 2023 7:50 pm
by rupertreynolds
*should say "Consola mono 8", of course. Accidental smiley.