You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

夏普MX-3060N扫描时进纸器非空却抛出DeviceFeederEmptyException问题

关于夏普MX-3060N使用NAPS2 SDK扫描时触发DeviceFeederEmptyException的问题

本人并非技术专家,若已有解决方案或发布位置不当,敬请谅解并告知。
我尝试使用夏普MX-3060N打印机,通过NAPS2 SDK .NET提供的代码扫描多页纸张并转换为PDF文档,代码如下:

// Set up
using var scanningContext = new ScanningContext(new GdiImageContext());

var controller = new ScanController(scanningContext);

// Query for available scanning devices
var devices = await controller.GetDeviceList();

// Set scanning options
var options = new ScanOptions
{
    Device = devices.First(),
    PaperSource = PaperSource.Feeder,
    PageSize = PageSize.A4,
    Dpi = 300
};

// Scan and save images
int i = 1;
await foreach (var image in controller.Scan(options))
{
    image.Save($"page{i++}.jpg");
}

// Scan and save PDF
var images = await controller.Scan(options).ToListAsync();
var pdfExporter = new PdfExporter(scanningContext);
await pdfExporter.Export("doc.pdf", images);

运行程序时,抛出异常:

An exception of type 'NAPS2.Scan.Exceptions.DeviceFeederEmptyException' occurred in System.Private.CoreLib.dll but was not handled in user code

提示内容:

Non ci sono fogli nell'alimentatore automatico.(自动进纸器中无纸张)

但实际上进纸器中有纸张且能完成扫描。我尝试修改参数并查找类似问题的解决方案,但未找到相关内容,每次调用Scan()方法都会触发该错误,恳请指教问题所在。


可能的解决方向:

  • 切换驱动类型:夏普MX-3060N的扫描驱动和NAPS2 SDK的适配可能存在细节冲突,尝试将初始化时的GdiImageContext替换为WiaImageContext,或者更新打印机的最新扫描驱动后再测试。
  • 调整扫描选项参数:
    • 若无需双面扫描,显式设置DuplexScanning = DuplexScanning.None,部分设备在检测双面模式时会误判进纸器状态。
    • 将PageSize = PageSize.A4改为AutoDetectPageSize = true,避免固定尺寸设置与实际纸张检测不匹配触发错误。
  • 捕获异常继续执行:既然实际扫描能完成,可以针对性捕获DeviceFeederEmptyException并忽略,不中断流程。示例修改:
// Scan and save images
int i = 1;
try
{
    await foreach (var image in controller.Scan(options))
    {
        image.Save($"page{i++}.jpg");
    }
}
catch (DeviceFeederEmptyException)
{
    // 忽略误报的进纸器空异常
}

// Scan and save PDF
List<IScannedImage> images = new List<IScannedImage>();
try
{
    images = await controller.Scan(options).ToListAsync();
}
catch (DeviceFeederEmptyException)
{
    // 捕获异常,此时images已包含扫描完成的页面
}
var pdfExporter = new PdfExporter(scanningContext);
await pdfExporter.Export("doc.pdf", images);
  • 升级NAPS2 SDK版本:尝试更新到最新版的NAPS2 SDK,新版本可能修复了特定设备的兼容性问题。

内容的提问来源于stack exchange,提问作者MonkeMonke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 10:53:21