1

I am having trouble printing from a TextBox in WPF

My Textbox will only contain a number between 1 and 999

I wanted to print font size 72 and the text enclosed within a 4" box (so they can cut around the edges)

    private void InvokePrint(String contentToPrint)
    {
        // Create the print dialog object and set options
        PrintDialog pDialog = new PrintDialog();
        pDialog.PageRangeSelection = PageRangeSelection.AllPages;
        pDialog.UserPageRangeEnabled = true;

        // Display the dialog. This returns true if the user presses the Print button.
        Nullable<Boolean> print = pDialog.ShowDialog();
        if (print == true)
        {
            FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence();
            pDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Printing Label");
        }
    }

I got the code from Microsoft's site but they are using an XPS printer. I want to use the default selected printer (usually an HP).

Any help would greatly be appreciated

software is fun
  • 7,286
  • 18
  • 71
  • 129

0 Answers0