@@ -178,47 +178,57 @@ int main(int argc, char *argv[])
178178 string path = string (pszImageFile);
179179 // fileFetcher->SetFile(pszImageFile);
180180 // errorCode = cvr->StartCapturing(CPresetTemplate::PT_READ_BARCODES, true, errorMsg, 512);
181- if (endsWith (path, " .pdf" ) || endsWith (path, " .tif" ))
181+ // if (endsWith(path, ".pdf") || endsWith(path, ".tif"))
182+ // {
183+ // fileFetcher->SetFile(pszImageFile);
184+ // errorCode = cvr->StartCapturing(CPresetTemplate::PT_READ_BARCODES, true, errorMsg, 512);
185+ // }
186+ // else
182187 {
183- fileFetcher->SetFile (pszImageFile);
184- errorCode = cvr->StartCapturing (CPresetTemplate::PT_READ_BARCODES, true , errorMsg, 512 );
185- }
186- else
187- {
188- CCapturedResult *result = cvr->Capture (pszImageFile, CPresetTemplate::PT_READ_BARCODES);
188+ CCapturedResultArray *captureResultArray = cvr->CaptureMultiPages (pszImageFile, CPresetTemplate::PT_READ_BARCODES);
189189
190- if (result->GetErrorCode () != 0 )
191- {
192- cout << " Error: " << result->GetErrorCode () << " ," << result->GetErrorString () << endl;
193- }
194- CDecodedBarcodesResult *barcodeResult = result->GetDecodedBarcodesResult ();
195- if (barcodeResult == nullptr || barcodeResult->GetItemsCount () == 0 )
196- {
197- cout << " No barcode found." << endl;
198- }
199- else
200- {
201- int barcodeResultItemCount = barcodeResult->GetItemsCount ();
202- cout << " Decoded " << barcodeResultItemCount << " barcodes" << endl;
190+ int count = captureResultArray->GetResultsCount ();
203191
204- for (int j = 0 ; j < barcodeResultItemCount; j++)
192+ for (int i = 0 ; i < count; i++)
193+ {
194+ CCapturedResult *result = (CCapturedResult *)captureResultArray->GetResult (i);
195+ result->GetOriginalImageTag ()->GetImageId ();
196+ cout << " >>>>>>>>>>>>>>>>> Image " << i + 1 << " :" << endl;
197+ if (result->GetErrorCode () != 0 )
205198 {
206- const CBarcodeResultItem *barcodeResultItem = barcodeResult->GetItem (j);
207- cout << " Result " << j + 1 << endl;
208- cout << " Barcode Format: " << barcodeResultItem->GetFormatString () << endl;
209- cout << " Barcode Text: " << barcodeResultItem->GetText () << endl;
199+ cout << " Error: " << result->GetErrorCode () << " ," << result->GetErrorString () << endl;
200+ }
201+ CDecodedBarcodesResult *barcodeResult = result->GetDecodedBarcodesResult ();
202+ if (barcodeResult == nullptr || barcodeResult->GetItemsCount () == 0 )
203+ {
204+ cout << " No barcode found." << endl;
205+ }
206+ else
207+ {
208+ int barcodeResultItemCount = barcodeResult->GetItemsCount ();
209+ cout << " Decoded " << barcodeResultItemCount << " barcodes" << endl;
210210
211- CPoint *points = barcodeResultItem->GetLocation ().points ;
212- for (int j = 0 ; j < 4 ; j++)
211+ for (int j = 0 ; j < barcodeResultItemCount; j++)
213212 {
214- cout << " Point " << j + 1 << " : (" << points[j][0 ] << " , " << points[j][1 ] << " )" << endl;
213+ const CBarcodeResultItem *barcodeResultItem = barcodeResult->GetItem (j);
214+ cout << " Result " << j + 1 << endl;
215+ cout << " Barcode Format: " << barcodeResultItem->GetFormatString () << endl;
216+ cout << " Barcode Text: " << barcodeResultItem->GetText () << endl;
217+
218+ CPoint *points = barcodeResultItem->GetLocation ().points ;
219+ for (int j = 0 ; j < 4 ; j++)
220+ {
221+ cout << " Point " << j + 1 << " : (" << points[j][0 ] << " , " << points[j][1 ] << " )" << endl;
222+ }
215223 }
216224 }
225+ if (barcodeResult)
226+ barcodeResult->Release ();
227+
228+ result->Release ();
217229 }
218- if (barcodeResult)
219- barcodeResult->Release ();
220230
221- result ->Release ();
231+ captureResultArray ->Release ();
222232 }
223233 }
224234
0 commit comments