-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmindee.php
More file actions
47 lines (35 loc) · 1.18 KB
/
mindee.php
File metadata and controls
47 lines (35 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require 'vendor/autoload.php';
use Mindee\Client;
use Mindee\Product\Generated\GeneratedV1;
use Mindee\Input\PredictMethodOptions;
use Mindee\Product\Invoice\InvoiceV4;
function CustomizedMindeeAPI($mindeeKey, $inputFile)
{
// Init a new client
$mindeeClient = new Client($mindeeKey);
// Load a file from disk
$inputSource = $mindeeClient->sourceFromPath($inputFile);
// Create a custom endpoint
$customEndpoint = $mindeeClient->createEndpoint(
"pdf_extract",
"hi-tech",
"1"
);
// Add the custom endpoint to the prediction options.
$predictOptions = new PredictMethodOptions();
$predictOptions->setEndpoint($customEndpoint);
// Parse the file
$apiResponse = $mindeeClient->enqueueAndParse(GeneratedV1::class, $inputSource, $predictOptions);
return $apiResponse->document;
}
function GeneralMindeeAPI($mindeeKey, $inputFile)
{
// Init a new client
$mindeeClient = new Client($mindeeKey);
// Load a file from disk
$inputSource = $mindeeClient->sourceFromPath($inputFile);
// Parse the file
$apiResponse = $mindeeClient->parse(InvoiceV4::class, $inputSource);
return $apiResponse->document;
}