Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended Scan Options for Linux/SANE #545

Open
yozhikov13 opened this issue Jan 24, 2025 · 0 comments
Open

Extended Scan Options for Linux/SANE #545

yozhikov13 opened this issue Jan 24, 2025 · 0 comments

Comments

@yozhikov13
Copy link

Problem
In the current version of NAPS2, it is not possible to configure additional scan options supported by the device and the SANE library. Specifically, there is a need for settings such as paper-protect and df-action.

While the SaneOptionController.cs file already includes the TrySet method, which allows working with these options, its use is restricted because the class and related components have the internal access modifier. This makes it impossible to configure advanced options without modifying the NAPS2 source code.

Why This Matters
Adding support for extended scan options would:

  • Simplify working with devices that support specific SANE parameters.
  • Avoid the need to modify the library source code, making it easier to update via NuGet.
  • Expand functionality for Linux users while maintaining compatibility wwith existing standard options.

Proposed Solution
Add a newproperty to the ScanOptions.cs, such as a dictionary Dictionary<string, string> (KeyValueScanOptions??), to allow specifying additional SANE options.

Example:

var options = new ScanOptions
    {
        Dpi = 300,
        PaperSource = PaperSource.Flatbed,
        AdvancedScanOptions = new Dictionary<string, string>
        {
            {"paper-protect", "Off"},
            {"df-action", "Continue"}
        }
    };

This property could be used to pass custom parameters to SaneOptionController.TrySet, which already handles such configurations.

Alternative Solutions

  • Extend the public API to make to work with some internal classes.
  • Add a more flexible system for configuring SANE options within the existing interface, such as by enabling direct registration of supported parameters.

Benefits

  • This feature would provide greater flexibility and convenience for a broader range of users.
  • It would preserve the ability to update the library via NuGet without requiring source code changes.

Thank You
Thank you for providing such an excellent library! I hope this suggestion will be helpful.

@yozhikov13 yozhikov13 changed the title Extended Scan Options fo Linux/SANE Extended Scan Options for Linux/SANE Jan 24, 2025
cyanfish added a commit that referenced this issue Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants