Skip to main content

Hello,

I need to create a parameter which shows me the printers are installed and I pick one for each type of document (For example: Invoices to Epson ESC/PR, Orders to Samsung 2145, etc.).

How I can get the printers that are installed on the system?

Thanks

Alberto Ferraz

Hello,

I need to create a parameter which shows me the printers are installed and I pick one for each type of document (For example: Invoices to Epson ESC/PR, Orders to Samsung 2145, etc.).

How I can get the printers that are installed on the system?

Thanks

Alberto Ferraz

I found an example for doing this. You can automatically bind a combo box control to the printer collection by adding the following namespace to your xaml:

xmlns:Printing="clr-namespace:System.Drawing.Printing;assembly=System.Drawing"

and then adding the System.Drawing assembly to your project references.

You can then define the combobox with:

<ComboBox x:Name="prtcomboBox" HorizontalAlignment="Left" Margin="89,119,0,0" VerticalAlignment="Top" Width="301" Height="21" ItemsSource="{x:Static Printing:PrinterSettings.InstalledPrinters}" SelectionChanged="prtcomboBox_SelectionChanged" />

Everytime a new printer is selected the prtcomboBox_SelectionChanged event will be triggered so you can get the selected printer name.

method-id prtcomboBox_SelectionChanged.
      procedure division using by value sender as object e as type System.Windows.Controls.SelectionChangedEventArgs.
          set textBox1::Text to prtcomboBox::SelectedValue
      end method.


Hello,

I need to create a parameter which shows me the printers are installed and I pick one for each type of document (For example: Invoices to Epson ESC/PR, Orders to Samsung 2145, etc.).

How I can get the printers that are installed on the system?

Thanks

Alberto Ferraz

Hi,

It was exactly the solution you were looking for.

Now a question in reverse: how do I carry this combo box to set printer option that comes from a field of the database?

For example: the maintenance of the types of documents table program have defined the bill with the Epson ESC P / R. When I change the movement type of record I want the combo box to appear selected Epson ESC P / R.

Best Regards

Alberto Ferraz


Hello,

I need to create a parameter which shows me the printers are installed and I pick one for each type of document (For example: Invoices to Epson ESC/PR, Orders to Samsung 2145, etc.).

How I can get the printers that are installed on the system?

Thanks

Alberto Ferraz

Hello,

Another issue that has to do with this: how do I print directly to the printer that is selected?

Thanks.

Best Regards

Alberto Ferraz


Hello,

I need to create a parameter which shows me the printers are installed and I pick one for each type of document (For example: Invoices to Epson ESC/PR, Orders to Samsung 2145, etc.).

How I can get the printers that are installed on the system?

Thanks

Alberto Ferraz

Hi,

Already decided the question differently and is working well.

Thank's