Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to show available printers when I want to print the diagram? (Read 1467 times)
Homam
Junior Member
**
Offline


I Love MindFusion!

Posts: 67
Joined: Feb 7th, 2012
How to show available printers when I want to print the diagram?
Sep 14th, 2014 at 7:24am
Print Post  
I'm not able to choose a printer when I try to print the diagram. Instead, it's using automatically the default printer.

Is there a way that allows me to choose a printer?

I'm using this code:
.

Code (Java)
Select All
DiagramView printView = new DiagramView(diagramToPrint);
printView.PrintOptions.DocumentName = ProcessName;
printView.PrintOptions.EnableImages = true;
printView.PrintOptions.EnableInterior = true;
printView.PrintOptions.EnableShadows = true;

printView.PrintOptions.Scale = 100;
printView.PrintOptions.Margins = new Margins(25, 25, 25, 25);

printView.PrintPreview();
 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to show available printers when I want to print the diagram?
Reply #1 - Sep 15th, 2014 at 9:51am
Print Post  
The PrintPreview method shows the standard .NET PrintPreviewDialog, which does not support printer selection. Try the extended preview dialog using PrintPreviewEx method, it shows a drop-down for printer selection. Otherwise you could let users select a printer using a PrintDialog before opening the preview, if you don't mind showing two dialogs in a row:

Code
Select All
var doc = new PrintDocument();
doc.DocumentName = "test";
doc.DefaultPageSettings.Margins = new Margins(25, 25, 25, 25);

var printDlg = new PrintDialog();
printDlg.AllowSelection = true;
printDlg.UseEXDialog = true;
printDlg.Document = doc;
if (printDlg.ShowDialog() == DialogResult.OK)
{
	var printView = new DiagramView(diagram);
	printView.PrintOptions.EnableImages = true;
	printView.PrintOptions.EnableInterior = true;
	printView.PrintOptions.EnableShadows = true;
	printView.PrintOptions.Scale = 100;
	printView.PrintPreview(doc);
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint