Highlighted
Outstanding Contributor.
Outstanding Contributor.
1847 views

Define the printer to a type of document

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Define the printer to a type of document

Jump to solution

Hi,

Already decided the question differently and is working well.

Thank's

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Define the printer to a type of document

Jump to solution

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.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Define the printer to a type of document

Jump to solution

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

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Define the printer to a type of document

Jump to solution

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

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

RE: Define the printer to a type of document

Jump to solution

Hi,

Already decided the question differently and is working well.

Thank's

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.