Export PDF annotations in Node.js
You can export annotations as Instant JSON using the instance.exportInstantJSON()
API method:
import fs from "node:fs";import { load } from "@nutrient-sdk/node";
const pdfDoc = fs.readFileSync("source.pdf");const myInstantJSON = JSON.parse( fs.readFileSync("instantjson.json", "utf-8"));
const instance = await load({ document: pdfDoc, instantJSON: myInstantJSON});const output = await instance.exportInstantJSON();await instance.close();
fs.writeFileSync("output.json", JSON.stringify(output));