我尝试将.rpt
文件打印到打印机上。我安装了Crystal Report Engine,并将CrystalDecisions.ReportAppServer.CommLayer.dll
添加到了我的项目中。
string rptFileName = @"C:\Users\User99\Desktop\Kommissionierliste.rpt";
string PrinterName = "Canon MX490 series Printer";
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(rptFileName);
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = PrinterName;
reportDocument.PrintToPrinter(printerSettings, new PageSettings(), false);
运行代码时出现错误,告诉我找不到文件。我认为它仍在寻找错误的版本(正在寻找13.0.2000.0,但我已经拥有13.0.3500.0)。
App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedruntime version="v4.0" sku=".netframework,version=v4.0"/>
</startup>
<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentassembly>
<assemblyidentity name="crystaldecisions.crystalreports.engine" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportsource" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.shared" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.web" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.windows.forms" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.clientdoc" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.commoncontrols" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.commonobjectmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.controllers" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.cubedefmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.datadefmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.datasetconversion" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.objectfactory" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.prompting" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.reportdefmodel" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
<dependentassembly>
<assemblyidentity name="crystaldecisions.reportappserver.xmlserialize" publickeytoken="692fbea5521e1304" culture="neutral"/>
<bindingredirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
</dependentassembly>
</assemblybinding>
</runtime>
</configuration>