def crop(id): '''crop pdf file in books/new/${id}.pdf''' srcPath = os.path.join(os.path.curdir, 'books', 'new', id+'.pdf') destPath = os.path.join(os.path.curdir, 'books', 'new', id+'.cropped.pdf') DuoPdf.cropWH(destPath, srcPath, 500, 666) os.remove(srcPath) os.rename(destPath, srcPath)
def crop(id): '''crop pdf file in books/new/${id}.pdf''' srcPath = os.path.join(os.path.curdir, 'books', 'new', id + '.pdf') destPath = os.path.join(os.path.curdir, 'books', 'new', id + '.cropped.pdf') DuoPdf.cropWH(destPath, srcPath, 500, 666) os.remove(srcPath) os.rename(destPath, srcPath)
def mergeSingle(src): if not os.path.isdir(src): Log.w(Duokan.__name__, '[%s] is not a diractory, exit...' % (src, )) return path = os.path.split(src) id = path[1] destPath = os.path.join(path[0], id+'.pdf') DuoPdf.clean(src) DuoPdf.merge(destPath, src)
def mergeSingle(src): if not os.path.isdir(src): Log.w(Duokan.__name__, '[%s] is not a diractory, exit...' % (src, )) return path = os.path.split(src) id = path[1] destPath = os.path.join(path[0], id + '.pdf') DuoPdf.clean(src) DuoPdf.merge(destPath, src)
def merge(id): '''merge pdf files in tmp/${id}, to books/new/${id}.pdf''' srcPath = os.path.join(os.path.curdir, 'tmp', id) destPath = os.path.join(os.path.curdir, 'books', 'new', id+'.pdf') DuoPdf.clean(srcPath) # clean pdf DuoPdf.merge(destPath, srcPath)
def crop4Nook(src): '''crop blank edge''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_n' + ext # print destPath DuoPdf.crop(destPath, src, 56, 40, 56, 40)
def crop4Kindle(src): '''crop blank edge''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_k' + ext # print destPath DuoPdf.crop(destPath, src, 50, 12, 50, 12)
def crop4Print(src): '''crop blank edge except first page''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_p' + ext # print destPath DuoPdf.crop2(destPath, src, (0, 12, 48, 12), (48, 12, 0, 12))
def cropSingle(src): '''crop pdf file''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_c' + ext DuoPdf.cropWH(destPath, src, 500, 666)
def merge(id): '''merge pdf files in tmp/${id}, to books/new/${id}.pdf''' srcPath = os.path.join(os.path.curdir, 'tmp', id) destPath = os.path.join(os.path.curdir, 'books', 'new', id + '.pdf') DuoPdf.clean(srcPath) # clean pdf DuoPdf.merge(destPath, srcPath)
def crop4Nook(src): '''crop blank edge''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_n' + ext # print destPath DuoPdf.crop(destPath, src, 56, 40, 56, 40)
def crop4Kindle(src): '''crop blank edge''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_k' + ext # print destPath DuoPdf.crop(destPath, src, 50, 12, 50, 12)
def crop4Print(src): '''crop blank edge except first page''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_p' + ext # print destPath DuoPdf.crop2(destPath, src, (0, 12, 48, 12), (48, 12, 0, 12))
def cropSingle(src): '''crop pdf file''' srcPath, ext = os.path.splitext(src) destPath = srcPath + '_c' + ext DuoPdf.cropWH(destPath, src, 500, 666)