c#代码在citrix环境中打印文档 [英] c# code to print a document in citrix enviornment

查看:80
本文介绍了c#代码在citrix环境中打印文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义C#应用程序,它有一个打印选项来打印图像。它使用WPF和printdialog显示打印对话框并打印图像。这在本地机器上工作正常。如果我在Citrix中部署此应用程序,则不会向用户显示本地打印机。其他标准应用程序显示本地打印机。是否需要显示本地打印机的其他代码?



没有Citrix它可以正常工作:



这是代码:



private String imgFileName;



public void PrintTiff(Document doc)

{

PrintDocument pd = new PrintDocument();



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

foreach(doc.Sources中的DOKuStar.Data.Xml.ImageSource imgSrc)

{

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(对象发送者,PrintPageEventArgs e)

{

System.Drawing.Image img = System.Drawing.Image.FromFile(imgFileName);

e .Graphics.DrawImage(img,1,1);

}

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);
}

推荐答案

就我而言,没有不同的代码听说过。



我在Citrix环境中遇到了一个问题,客户端必须设置一个愚蠢的打印机才能让他们笑在Citrix环境中使用。那是大约8年前的事情,我不记得我必须做些什么才能让它发挥作用。
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.


这篇关于c#代码在citrix环境中打印文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆