Problems printing Workflows from Workflow Designer.  
Author Message
John Portnov





PostPosted: Windows Workflow Foundation, Problems printing Workflows from Workflow Designer. Top

Vihang,

I have read your article at

http://www.hide-link.com/

I am having a problem printing a workflow. Have you tried using the Print menu and actually printed successfully the workflow diagram (or any part of it)

I am able to print from other applications.

I get the PrintDialog box and click ok, but nothing gets sent to my print queue. Any ideas

Sincerely,

John Portnov




Software Development for Windows Vista10  
 
 
_vihang





PostPosted: Windows Workflow Foundation, Problems printing Workflows from Workflow Designer. Top

You are right. It does not print. Just change the print code to the following

If(printDialog.ShowDialog() == DialogResult.OK)

printDialog.Document.Print();



 
 
John Portnov





PostPosted: Windows Workflow Foundation, Problems printing Workflows from Workflow Designer. Top

Vihang,

There is nothing wrong with the code. The code is just not finished. I have updated the function below to include the Print method call.

----------------------------------------------

private void PrintMenuItem_Click(object sender, EventArgs e)

{

WorkflowView workflowView = this.workflowDesignerControl1.WorkflowView;

if (null != workflowView)

{

//select printer

PrintDialog printDialog = new System.Windows.Forms.PrintDialog();

printDialog.AllowPrintToFile = true;

printDialog.AllowCurrentPage = true;

printDialog.AllowSelection = true;

printDialog.AllowSomePages = true;

printDialog.Document = workflowView.PrintDocument;

try

{

DialogResult _result = printDialog.ShowDialog();

if (_result == DialogResult.OK)

{

workflowView.PrintDocument.Print();

}

}

catch

{

string errorString = "Error selecting new printer";

MessageBox.Show(this, errorString, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);

}

}

}

--------------------------------------------------------------------

You may want to update your example (or remove the Print menu).

Sincerely,

John Portnov