自己一个小型的Winform项目中有使用到PDFCreator虚拟打印,在初始化PDFCreator虚拟打印机模块代码中,
private void initPdfPrinter()
{
try
{
wisePdfCreator = new PDFCreator.clsPDFCreator();
wisePdfCreatorError = new PDFCreator.clsPDFCreatorError();
wisePdfCreator.eError += new PDFCreator.__clsPDFCreator_eErrorEventHandler(wisePdfCreator_eError);
wisePdfCreator.eReady += new PDFCreator.__clsPDFCreator_eReadyEventHandler(wisePdfCreator_eReady);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
出现了如下图所示的问题,
研究了好久后来才发现,问题处在我的项目引用上面,项目中本来是要引用PDFCreator.exe这个COM程序的,之前项目引用没错,但是不知那天把这个引用去掉了,而是引用的VS 自动生成的Int

在C#项目中使用PDFCreator时遇到检索COM类失败的错误,原因是引用了VS自动生成的Interop.PDFCreator.dll而非PDFCreator.exe本身。删除dll,正确引用COM组件后,问题得到解决。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



