Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a custom C# application that has a print option to print an image. It uses the WPF and printdialog to show the print dialog and print the image. This works fine from a local machine. If I deploy this application in citrix, it does not show the users local printers. Other standard applications show the local printers. Is there any additional code required to show the local printers?

It works fine without Citrix:

Here is the code:

private String imgFileName;

public void PrintTiff(Document doc)
{
PrintDocument pd = new PrintDocument();

System.Windows.Forms.PrintDialog printDialog1 = new System.Windows.Forms.PrintDialog();
foreach (DOKuStar.Data.Xml.ImageSource imgSrc in doc.Sources)
{
imgFileName = imgSrc.Url;
pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
pd.OriginAtMargins = false;
pd.DefaultPageSettings.Landscape = false;

pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
}

printDialog1.Document = pd;
printDialog1.AllowSelection = true;
printDialog1.ShowNetwork = true;
printDialog1.UseEXDialog = true;
DialogResult result = printDialog1.ShowDialog();
if (result == DialogResult.OK)
{
pd.Print();
}

}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(imgFileName);
e.Graphics.DrawImage(img, 1, 1);
}
Posted
Updated 31-Mar-14 8:40am
v3

1 solution

There is no different code as far as I've ever heard of.

I have run into a problem in Citrix environments where the client had to have a goofy printer setup in order for them to show up in the Citrix environment. That was about 8 years ago and I can't remember what it was I had to do to get it to work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900