0

I am looking at how to send raw data to a printer in WPF. This is similar to the Microsoft solution http://support.microsoft.com/kb/322091/en-us however I want it to be in wpf vice using windows controls. Using the standard printing of wpf does not work as i need to send raw data vice the documentpage. I already know how to print the item but not get the printer name without doing a custom dialog or using winforms. Does anyone know how to do this?

I am printing to a thermal printer, this is why I can not use the printdocument or similar items in wpf.

1 Answer 1

0

Finally figured this out. Sample code below:

using System.Printing;

PrintDialog _printDialog = new PrintDialog();
bool? _print = _printDialog.ShowDialog();

if (_print == true)
{
    string _printerName = **_printDialog.PrintQueue.FullName**;
    RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, s)
}

RawPrinterHelper is from Microsoft Article above. to get the selected printer you need to use the PrintQueue.FullName property. Note the FullName may not show in Intellisense but does work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.