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