Question: Printer type **hp officejet pro 6830**  

Is there a way to scan from html/java script image from a scanner ?  

If it cant be done can anyone recommend a **lib** for java that give access to the printer/scanner.

The over all idea is to add a **button** to web page and scan image back to the page or to a local folder 

I already tried using **Scanner.js**: HTML/JavaScript Web Twain WIA 

but it didnt work for me not sure why?

thanks

Answer: 
After trying require with requireJS and the text plugin which did not work for me, I managed to make it work using 'ng-include' as follow:

```
angular.module('appName').component('nameComponent', {
template: `<ng-include src="'path_to_file/file-name.html'"></ng-include>`,

```

I hope this helps!
I use webpack's require.context for this:

**templates-factory.js**

```
import {resolve} from 'path';

/**
 * Wrap given context in AngularJS $templateCache
 * @param ctx - A context module
 * @param dir - module directory
 * @returns {function(...*): void} - AngularJS Run function
 */
export const templatesFactory = (ctx, dir, filename) => {
    return $templateCache => ctx.keys().forEach(key => {

        const templateId = (() => {
            switch (typeof filename) {
                case 'function':
                    return resolve(dir, filename(key));
                case 'string':
                    return resolve(dir, filename);
                default:
                    return resolve(dir, key);
            }
        })();

        $templateCache.put(templateId, ctx(key));
    });
};

```

**app.html-bundle.js**

```
   import {templatesFactory} from './templates-factory';

    const ctx = require.context('./', true, /\.html$/);

    export const AppHtmlBundle = angular.module('AppHtmlBundle', [])
        .run(templatesFactory(ctx, __dirname))
        .name;

```

Don't forget to add html-loader to your **webpack.config.js**:

```
 [{
    test: /\.html$/,
    use: {
        loader: 'html-loader',
        options: {
            minimize: false,
            root: path.resolve(__dirname, './src')
        }
    }
}]

```

Also you may need to convert relative paths to absolute one. I use my self-written babel plugin **ng-template-url-absolutify** for this purpose:

```
[{
    test: /\.(es6|js)$/,
    include: [path.resolve(__dirname, 'src')],
    exclude: /node_modules/,
    loader: 'babel-loader',
    options: {
        plugins: [
            '@babel/plugin-syntax-dynamic-import',
            ['ng-template-url-absolutify', {baseDir: path.resolve(__dirname, 'src'), baseUrl: ''}]
        ],

        presets: [['@babel/preset-env', {'modules': false}]]
    }
},

```