@@ -49,9 +49,14 @@ def parse_receipt(
4949 input_type = "path" ,
5050 version = "3" ,
5151 cut_pdf = True ,
52- include_words = False
52+ include_words = False ,
53+ cut_pdf_mode = 3 ,
5354 ):
5455 """
56+ :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
57+ if 1: pages [0]
58+ if 2: pages [0, n-2]
59+ if 3: pages [0, n-2, n-1]
5560 :param include_words: Bool, extract all words into http_response
5661 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
5762 :param input_type: String in {'path', 'stream', 'base64'}
@@ -62,7 +67,7 @@ def parse_receipt(
6267 if not self .expense_receipt_token :
6368 raise Exception ("Missing 'expense_receipt_token' arg in parse_receipt() function." )
6469
65- input_file = Inputs (file , input_type , cut_pdf = cut_pdf )
70+ input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
6671
6772 response = Receipt .request (
6873 input_file ,
@@ -106,9 +111,14 @@ def parse_passport(
106111 file ,
107112 input_type = "path" ,
108113 version = "1" ,
109- cut_pdf = True
114+ cut_pdf = True ,
115+ cut_pdf_mode = 3 ,
110116 ):
111117 """
118+ :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
119+ if 1: pages [0]
120+ if 2: pages [0, n-2]
121+ if 3: pages [0, n-2, n-1]
112122 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
113123 :param input_type: String in {'path', 'stream', 'base64'}
114124 :param file: Passport filepath (allowed jpg, png, pdf)
@@ -118,7 +128,7 @@ def parse_passport(
118128 if not self .passport_token :
119129 raise Exception ("Missing 'passport_token' arg in parse_passport() function." )
120130
121- input_file = Inputs (file , input_type , cut_pdf = cut_pdf )
131+ input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
122132
123133 response = Passport .request (
124134 input_file ,
@@ -134,9 +144,14 @@ def parse_license_plate(
134144 file ,
135145 input_type = "path" ,
136146 version = "1" ,
137- cut_pdf = True
147+ cut_pdf = True ,
148+ cut_pdf_mode = 3 ,
138149 ):
139150 """
151+ :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
152+ if 1: pages [0]
153+ if 2: pages [0, n-2]
154+ if 3: pages [0, n-2, n-1]
140155 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
141156 :param input_type: String in {'path', 'stream', 'base64'}
142157 :param file: CarPlate filepath (allowed jpg, png, pdf)
@@ -146,7 +161,7 @@ def parse_license_plate(
146161 if not self .license_plate_token :
147162 raise Exception ("Missing 'license_plate_token' arg in license_plate_token() function." )
148163
149- input_file = Inputs (file , input_type , cut_pdf = cut_pdf )
164+ input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
150165
151166 response = CarPlate .request (
152167 input_file ,
@@ -163,9 +178,14 @@ def parse_invoice(
163178 input_type = "path" ,
164179 version = "2" ,
165180 cut_pdf = True ,
166- include_words = False
181+ include_words = False ,
182+ cut_pdf_mode = 3 ,
167183 ):
168184 """
185+ :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
186+ if 1: pages [0]
187+ if 2: pages [0, n-2]
188+ if 3: pages [0, n-2, n-1]
169189 :param include_words: Bool, extract all words into http_response
170190 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
171191 :param input_type: String in {'path', 'stream', 'base64'}
@@ -176,7 +196,7 @@ def parse_invoice(
176196 if not self .invoice_token :
177197 raise Exception ("Missing 'invoice_token' arg in parse_invoice() function." )
178198
179- input_file = Inputs (file , input_type , cut_pdf = cut_pdf )
199+ input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
180200
181201 response = Invoice .request (
182202 input_file ,
@@ -193,9 +213,14 @@ def parse_financial_document(
193213 file ,
194214 input_type = "path" ,
195215 cut_pdf = True ,
196- include_words = False
216+ include_words = False ,
217+ cut_pdf_mode = 3 ,
197218 ):
198219 """
220+ :param cut_pdf_mode: Number (between 1 and 3 incl.) of pages to reconstruct a pdf with.
221+ if 1: pages [0]
222+ if 2: pages [0, n-2]
223+ if 3: pages [0, n-2, n-1]
199224 :param include_words: Bool, extract all words into http_response
200225 :param cut_pdf: Automatically reconstruct pdf with more than 4 pages
201226 :param input_type: String in {'path', 'stream', 'base64'}
@@ -205,7 +230,7 @@ def parse_financial_document(
205230 if not self .invoice_token or not self .expense_receipt_token :
206231 raise Exception ("parse_invoice() function must include 'invoice_token' and 'expense_receipt_token' args." )
207232
208- input_file = Inputs (file , input_type , cut_pdf = cut_pdf )
233+ input_file = Inputs (file , input_type , cut_pdf = cut_pdf , n_pdf_pages = cut_pdf_mode )
209234
210235 response = FinancialDocument .request (
211236 input_file ,
0 commit comments