1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "documentUrls": [],
10 "targetSchema": {
11 "type": "object",
12 "properties": {
13 "invoiceNumber": {
14 "type": "string",
15 "title": "Invoice Number",
16 },
17 "totalAmount": {
18 "type": "number",
19 "title": "Total Amount",
20 },
21 "lineItems": {
22 "type": "array",
23 "title": "Line Items",
24 "items": {
25 "type": "object",
26 "properties": {
27 "description": {
28 "type": "string",
29 "title": "Description",
30 },
31 "quantity": {
32 "type": "integer",
33 "title": "Quantity",
34 },
35 "unitPrice": {
36 "type": "number",
37 "title": "Unit Price",
38 },
39 },
40 },
41 },
42 },
43 },
44}
45
46
47run = client.actor("thomas.5fm/pdf-to-json-schema-extractor").call(run_input=run_input)
48
49
50print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
51for item in client.dataset(run["defaultDatasetId"]).iterate_items():
52 print(item)
53
54