1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "fileUrls": [
12 "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
13 ],
14 "schema": {
15 "type": "object",
16 "properties": {
17 "vendor": {
18 "type": "string"
19 },
20 "invoice_number": {
21 "type": "string"
22 },
23 "date": {
24 "type": "string",
25 "description": "YYYY-MM-DD"
26 },
27 "total": {
28 "type": "number"
29 },
30 "currency": {
31 "type": "string"
32 }
33 }
34 }
35};
36
37
38const run = await client.actor("halrohm/document-to-markdown-ocr").call(input);
39
40
41console.log('Results from dataset');
42console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
43const { items } = await client.dataset(run.defaultDatasetId).listItems();
44items.forEach((item) => {
45 console.dir(item);
46});
47
48