I will begin saying I’m not an expert so if there’s already a solution to this or this isn’t the right place to post this I apologize and I’ll correct it.
That said I tried scanning with my printer a bunch of paper and have it convert it int PDF docs using the code posted in the NAPS2 SDK .NET:
// 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);
When I attempt to run the program I get this exception:
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.
(There are no papers in the automatic feeder) even though it scans the pages in the feeder.
I tried changing params and researching anyone that had a similar problem but it seems it’s only me for now, or everyone can figure it out but me which may very well be the case.
I get the error whenever the “Scan()” method launches and I’m at a loss.
What am I missing?
I have deadlines and coworkers will realize I’m bad at coding lol please help.
Best regards,
A nervous imposter.
Alf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.