import { NdiClient } from "ndi-sdk";
const client = new NdiClient();
const upload = await client.documents.createUpload("report.pdf");
const job = await client.jobs.wait(
(
await client.documents.ground(upload, {
targets: [{ id: "total", text: "1,200.50" }],
wait_seconds: 30,
})
).job_id,
);
if (job.result?.result_type === "ground" && "targets" in job.result) {
for (const target of job.result.targets) {
for (const match of target.matches ?? []) {
console.log(target.id, match.matched_text, match.location);
}
}
}