FoxIt PDF SDK - AccessViolationException in PrintWithDialog



场景:WinForms桌面应用程序,.Net 2.0

我们遇到了0.01%的用户无法打印我们通过FoxIt PDF SDK ActiveX v5.0.1 呈现的文档的问题

当用户单击"打印"按钮时,我们在查看器控件实例上调用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、记事本等打印无问题。

如果我删除默认的打印机设置(意味着没有打印机设置为默认值),我可以模拟这种情况,因此将以下窗口注册表项从"Device"临时重命名为"OldDevice"

HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionWindowsDevice

我的简单形式:

public Form1()
{
    InitializeComponent();
    try
    {
        this.axFoxitPDFSDK1.OpenFile(@"C:foxitFoxitPDFActiveX51_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:WindowsassemblyGAC_MSILSystem.Configuration2.0.0.0__b03f5f7f11d50a3aSystem.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:foxitMySOfoxitForm1.cs:riga 23
Tentativo di lettura o scrittura della memoria protetta. Spesso questa condizione indica che altre parti della memoria sono danneggiate.

我可以提到这个链接作为(可能)触发事件的可能原因之一。其他应用程序(WinWord、Adobe Reader)按预期工作(只需要手动选择打印机)

最新更新