@@ -96,10 +96,36 @@ def image_resize(self, file=None, width=None, height=None, crop=None):
9696if not 200 <= r .status_code < 300 :
9797raise APIError (data ['code' ],data ['message' ])
9898return data
99+
100+ def pdf_compress (self ,file = None ,quality = None ,dpi = None ):
101+ files = {'file' :open (file ,'rb' )}
102+ data = {
103+ 'quality' :quality ,
104+ 'dpi' :dpi
105+ }
106+ r = requests .post (API_URL + '/pdf/compress' ,auth = self .interceptor ,files = files ,data = data )
107+ data = r .json ()
108+ if not 200 <= r .status_code < 300 :
109+ raise APIError (data ['code' ],data ['message' ])
110+ return data
99111
100- def pdf_image (self ,file = None ):
112+ def pdf_image (self ,file = None ,extract = None ):
113+ files = {'file' :open (file ,'rb' )}
114+ data = {
115+ 'extract' :extract
116+ }
117+ r = requests .post (API_URL + '/pdf/image' ,auth = self .interceptor ,files = files ,data = data )
118+ data = r .json ()
119+ if not 200 <= r .status_code < 300 :
120+ raise APIError (data ['code' ],data ['message' ])
121+ return data
122+
123+ def pdf_split (self ,file = None ,pages = None ):
101124files = {'file' :open (file ,'rb' )}
102- r = requests .post (API_URL + '/pdf/image' ,auth = self .interceptor ,files = files )
125+ data = {
126+ 'pages' :pages
127+ }
128+ r = requests .post (API_URL + '/pdf/split' ,auth = self .interceptor ,files = files ,data = data )
103129data = r .json ()
104130if not 200 <= r .status_code < 300 :
105131raise APIError (data ['code' ],data ['message' ])