crystal-reportsdesktop-applicationdllimporttwain

TWAIN scanners is not working after crystal report export to disk method in vb.net


I am developing windows application. In that, I using crystal report v13.0.2000.0. and used ExporttoDisk Method to create PDF file from Crystal report. and we are using TSScan for scanning purpose as scanner is in remote place.

When i try to Export the file on Disk using Crystal report DLL and then after i try to scan a new file, i got the error "Device is not open".

My code is as below. I found that the issue is generated only in case when the "ExportToDisk" line is executed. after executing this function I am not able to scan a new file. it gives error of "Device is not open".

Dim objReport As CrystalDecisions.CrystalReports.Engine.ReportClass
objReport = New ReportName
objReport.SetDataSource(DataSource)

objReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "FileName")

And after the calling this method scanner not recognized any devices. So i dont know why this happened. TSScan is working fine until we call crystal report export to disk method.


Solution

  • try this code:

    objReport.ExportOptions.DestinationType = CRExportDestinationType.crEDTDiskFile;
    objReport.ExportOptions.FormatType = CRExportFormatType.crEFTCrystalReport;
    DiskFileDestinationOptions fileOption = new DiskFileDestinationOptions();
    fileOption.DiskFileName = "Test.rpt";
    objReport.ExportOptions.DiskFileName = fileOption.DiskFileName;
    objReport.Export(false);