Esempio n. 1
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)
Esempio n. 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)
Esempio n. 3
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)
Esempio n. 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)
Esempio n. 5
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)
Esempio n. 6
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)
Esempio n. 7
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)
Esempio n. 8
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))
Esempio n. 9
0
 def cropSingle(src):
     '''crop pdf file'''
     srcPath, ext = os.path.splitext(src)
     destPath = srcPath + '_c' + ext
     DuoPdf.cropWH(destPath, src, 500, 666)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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))
Esempio n. 14
0
 def cropSingle(src):
     '''crop pdf file'''
     srcPath, ext = os.path.splitext(src)
     destPath = srcPath + '_c' + ext
     DuoPdf.cropWH(destPath, src, 500, 666)