场景: WinForms桌面应用程序,.Net 2.0
我们有0.01%的用户无法打印我们通过FoxIt PDF v5.0.1提供的文档。
当用户单击"Print“按钮时,我们将调用查看器控件实例上的PrintWithDialog()方法。此时,将引发访问冲突异常,然后应用程序挂起。没有显示“打印对话框”。没有更多的用户输入(鼠标、键盘)使其恢复生机,进程必须通过任务管理器来终止。
异常堆栈跟踪是:
AccessViolationException - Attempted to read or write protected memory. This is
often an indication that other memory is corrupt.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at FoxitPDFSDKStdLib._DFoxitPDFSDK.PrintWithDialog()
at AxFoxitPDFSDKStdLib.AxFoxitPDFSDK.PrintWithDialog()
at MyCode.PDFToolBarButtonClick(Object sender, EventArgs e)我们不能重现问题,而且FoxIt似乎无法做任何事情来帮助我们,因为我们不能给他们一个再现问题的项目。
我的怀疑指向Windows 7和打印设置的组策略控制。我们已经成功地要求受影响的用户删除并重新安装默认打印机,但是问题在一两天后再次出现。一个站点具有策略设置,控制谁可以彩色打印,并以不同的方式安装打印机(相同的物理设备)。
是否有人有过Windows 7或组策略设置影响打印的经验?
编辑:只有FoxIt受到这个问题的影响。其他一切- Acrobat,Word,记事本等打印没有问题。
发布于 2015-03-03 21:10:09
如果删除默认打印机设置(意味着没有打印机设置为默认值),则可以模拟这种情况,因此临时将下面的窗口注册表项从"OldDevice“重命名为”“。
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device我的简单表格:
public Form1()
{
InitializeComponent();
try
{
this.axFoxitPDFSDK1.OpenFile(@"C:\foxit\FoxitPDFActiveX51_Manual.pdf", "");
this.axFoxitPDFSDK1.PrintWithDialog();
}
catch (System.Exception exc)
{
Debug.WriteLine(exc.StackTrace);
Debug.WriteLine(exc.Message);
if (exc.InnerException != null)
{
Debug.WriteLine(exc.InnerException.Message);
}
}
}以及调试的相关输出:
Eccezione first-chance di tipo 'System.AccessViolationException' in mscorlib.dll
'MySOfoxit.vshost.exe' (Gestito (v2.0.50727)): 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' caricato, caricamento simboli ignorato. Il modulo è ottimizzato e l'opzione 'Just My Code' del debugger è abilitata.
in System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
in FoxitPDFSDKStdLib._DFoxitPDFSDK.PrintWithDialog()
in AxFoxitPDFSDKStdLib.AxFoxitPDFSDK.PrintWithDialog()
in MySOfoxit.Form1..ctor() in c:\foxit\MySOfoxit\Form1.cs:riga 23
Tentativo di lettura o scrittura della memoria protetta. Spesso questa condizione indica che altre parti della memoria sono danneggiate.我可以提到这个链接是(可能)触发事件的可能原因之一。其他应用程序(WinWord、Adobe )按预期工作(只需要手动选择打印机)
https://stackoverflow.com/questions/28674731
复制相似问题