예제 #1
0
def do_print():
    from calibre.customize.ui import plugin_for_input_format
    stdin = getattr(sys.stdin, 'buffer', sys.stdin)
    data = msgpack_loads(stdin.read())
    ext = data['input'].lower().rpartition('.')[-1]
    input_plugin = plugin_for_input_format(ext)
    if input_plugin is None:
        raise ValueError('Not a supported file type: {}'.format(ext.upper()))
    args = [
        'ebook-convert', data['input'], data['output'], '--paper-size',
        data['paper_size'], '--pdf-add-toc', '--disable-remove-fake-margins',
        '--chapter-mark', 'none', '-vv'
    ]
    if input_plugin.is_image_collection:
        args.append('--no-process')
    else:
        args.append('--disable-font-rescaling')
        args.append('--page-breaks-before=/')
    if data['page_numbers']:
        args.append('--pdf-page-numbers')
    for edge in 'left top right bottom'.split():
        args.append('--pdf-page-margin-' + edge), args.append(
            '%.1f' % (data['margin_' + edge] * 72))
    from calibre.ebooks.conversion.cli import main
    main(args)
예제 #2
0
def do_print():
    data = cPickle.loads(sys.stdin.read())
    args = ['ebook-convert', data['input'], data['output'], '--override-profile-size', '--paper-size', data['paper_size'], '--pdf-add-toc',
            '--disable-remove-fake-margins', '--disable-font-rescaling', '--page-breaks-before', '/', '--chapter-mark', 'none', '-vv']
    if data['page_numbers']:
        args.append('--pdf-page-numbers')
    for edge in 'left top right bottom'.split():
        args.append('--margin-' + edge), args.append('%.1f' % (data['margin_' + edge] * 72))
    from calibre.ebooks.conversion.cli import main
    main(args)
예제 #3
0
def do_print():
    data = cPickle.loads(sys.stdin.read())
    args = ['ebook-convert', data['input'], data['output'], '--override-profile-size', '--paper-size', data['paper_size'], '--pdf-add-toc',
            '--disable-remove-fake-margins', '--disable-font-rescaling', '--page-breaks-before', '/', '--chapter-mark', 'none', '-vv']
    if data['page_numbers']:
        args.append('--pdf-page-numbers')
    for edge in 'left top right bottom'.split():
        args.append('--margin-' + edge), args.append('%.1f' % (data['margin_' + edge] * 72))
    from calibre.ebooks.conversion.cli import main
    main(args)
예제 #4
0
def do_print():
    from calibre.customize.ui import plugin_for_input_format
    stdin = getattr(sys.stdin, 'buffer', sys.stdin)
    data = msgpack_loads(stdin.read())
    ext = data['input'].lower().rpartition('.')[-1]
    input_plugin = plugin_for_input_format(ext)
    args = ['ebook-convert', data['input'], data['output'], '--paper-size', data['paper_size'], '--pdf-add-toc',
            '--disable-remove-fake-margins', '--chapter-mark', 'none', '-vv']
    if input_plugin.is_image_collection:
        args.append('--no-process')
    else:
        args.append('--disable-font-rescaling')
        args.append('--page-breaks-before=/')
    if data['page_numbers']:
        args.append('--pdf-page-numbers')
    for edge in 'left top right bottom'.split():
        args.append('--pdf-page-margin-' + edge), args.append('%.1f' % (data['margin_' + edge] * 72))
    from calibre.ebooks.conversion.cli import main
    main(args)
예제 #5
0
def build_book(src, dest, args=()):
    from calibre.ebooks.conversion.cli import main
    main(['ebook-convert', src, dest] + list(args))
예제 #6
0
파일: base.py 프로젝트: j-howell/calibre
def build_book(src, dest, args=()):
    from calibre.ebooks.conversion.cli import main
    main(['ebook-convert', src, dest] + list(args))