lib/output/ebook/onFinish.js
function runEbookConvert(output) {
    var logger = output.getLogger();
    var options = output.getOptions();
    var format = options.get('format');
    var outputFolder = output.getRoot();

    if (!format) {
        return Promise(output);
    }

    return getConvertOptions(output)
    .then(function(options) {
        var cmd = [
            'ebook-convert',
            path.resolve(outputFolder, SUMMARY_FILE),
            path.resolve(outputFolder, 'index.' + format),
            command.optionsToShellArgs(options)
        ].join(' ');

        return command.exec(cmd)
        .progress(function(data) {
            logger.debug(data);
        })
        .fail(function(err) {
            if (err.code == 127) {
                throw error.RequireInstallError({
                    cmd: 'ebook-convert',
                    install: 'Install it from Calibre: https://calibre-ebook.com'
                });
            }

            throw error.EbookError(err);
        });
    })
    .thenResolve(output);
}
function runEbookConvert(output) {
    var logger = output.getLogger();
    var options = output.getOptions();
    var format = options.get('format');
    var outputFolder = output.getRoot();

    if (!format) {
        return Promise(output);
    }

    return getConvertOptions(output)
    .then(function(options) {
        var cmd = [
            'ebook-convert',
            path.resolve(outputFolder, SUMMARY_FILE),
            path.resolve(outputFolder, 'index.' + format),
            command.optionsToShellArgs(options)
        ].join(' ');

        return command.exec(cmd)
        .progress(function(data) {
            logger.debug(data);
        })
        .fail(function(err) {
            if (err.code == 127) {
                throw error.RequireInstallError({
                    cmd: 'ebook-convert',
                    install: 'Install it from Calibre: https://calibre-ebook.com'
                });
            }

            throw error.EbookError(err);
        });
    })
    .thenResolve(output);
}
function runEbookConvert ( output ) { var logger = output . getLogger ( ) ; var options = output . getOptions ( ) ; var format = options . get ( 'format' ) ; var outputFolder = output . getRoot ( ) ; if ( ! format ) { return Promise ( output ) ; } return getConvertOptions ( output ) . then ( function ( options ) { var cmd = [ 'ebook-convert' , path . resolve ( outputFolder , SUMMARY_FILE ) , path . resolve ( outputFolder , 'index.' + format ) , command . optionsToShellArgs ( options ) ] . join ( ' ' ) ; return command . exec ( cmd ) . progress ( function ( data ) { logger . debug ( data ) ; } ) . fail ( function ( err ) { if ( err . code == 127 ) { throw error . RequireInstallError ( { cmd : 'ebook-convert' , install : 'Install it from Calibre: https://calibre-ebook.com' } ) ; } throw error . EbookError ( err ) ; } ) ; } ) . thenResolve ( output ) ; }
Generate the ebook file as "index.pdf"

@param {Output}
@return {Output}
Generate the ebook file as index . pdf