示例#1
0
文件: duoMain.py 项目: susemm/books
 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)
示例#2
0
 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)
示例#3
0
文件: duoMain.py 项目: susemm/books
 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)
示例#4
0
 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)
示例#5
0
文件: duoMain.py 项目: susemm/books
 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)
示例#6
0
文件: duoMain.py 项目: susemm/books
 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)
示例#7
0
文件: duoMain.py 项目: susemm/books
 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)
示例#8
0
文件: duoMain.py 项目: susemm/books
 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))
示例#9
0
文件: duoMain.py 项目: susemm/books
 def cropSingle(src):
     '''crop pdf file'''
     srcPath, ext = os.path.splitext(src)
     destPath = srcPath + '_c' + ext
     DuoPdf.cropWH(destPath, src, 500, 666)
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 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)
示例#13
0
 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))
示例#14
0
 def cropSingle(src):
     '''crop pdf file'''
     srcPath, ext = os.path.splitext(src)
     destPath = srcPath + '_c' + ext
     DuoPdf.cropWH(destPath, src, 500, 666)