0

So I am printing out some text from a textbox, which has wordwrapping enabled, but when I print out the document, the string that should be wordwrapped does not, and cuts offs on the page. I'd like to simply enable word wrapping for my printed document. Also is there a way to set the margins for the printed document, some of the text gets cut off from both the top and left margins. Thanks! Code attached below.

        FixedDocument document = new FixedDocument();
        document.DocumentPaginator.PageSize = new Size(printDlg.PrintableAreaWidth, printDlg.PrintableAreaHeight);

        FixedPage page1 = new FixedPage();
        page1.Width = document.DocumentPaginator.PageSize.Width;
        page1.Height = document.DocumentPaginator.PageSize.Height;
        MessageBox.Show(page1.Height.ToString() + page1.Width);

        GridType.Children.Remove(Textbox);
        page1.Children.Add(Textbox);

        PageContent page1Content = new PageContent();

        ((IAddChild)page1Content).AddChild(page1);
        document.Pages.Add(page1Content);

        printDlg.PrintDocument(document.DocumentPaginator, "My first document");

        page1.Children.Remove(Textbox);
        GridType.Children.Add(Textbox);
matzone
  • 5,703
  • 3
  • 17
  • 20
user1819301
  • 113
  • 4
  • 17

1 Answers1

0

Your textbox setting won't applied in PrintDoc .. you must recalculate all in your printdoc printpage event

matzone
  • 5,703
  • 3
  • 17
  • 20
  • Should I keep all my other Print Settings? I still want it to be printed from the PrintDialogBox. – user1819301 Jul 11 '13 at 15:27
  • @user1819301 .. your printer setting won't be affected to your environment setting .. it's just work for your current printdoc printer setting ... – matzone Jul 11 '13 at 15:29