Copy link to clipboard
Copied
I am using indesign version 20.0.0 ans UXP verison 8.0.1.
I want to fetch the location of comment in pdf where it is applied.
PdfComment's property commentPathGeometry is giving error.
Exception: Error: The requested action could not be completed because the object no longer exists. at PDFComment.invokeGetter (<anonymous>:6:32)
Below is the code snippet which I had used for fetching comments and screenshot of PDFComment object with exception..
const { entrypoints, storage } = require("uxp");
const { app } = require("indesign");
if (app.documents.length > 0) {
const doc = app.activeDocument;
if (doc.pdfComments.length > 0) {
for (let i = 0; i < doc.pdfComments.length; i++) {
const comment = doc.pdfComments.item(i);
console.log(comment);
}
}
}
Copy link to clipboard
Copied
In this line:
const comment = doc.pdfComments.item(i);
should const not be a var (or a let)?
Copy link to clipboard
Copied
It doesn't work either with var.
Copy link to clipboard
Copied
Strange that const works in your script, because it isn't a const. But anyway, UXP thinks it's not a problem (ExtendScript correctly returns an error here).
But your script works fine over here. Though when I try some other properties and run the script as a UXP one, I get the same error you saw. commentPathGeometry, for instance, throws that error. Both in 2024 and 2025 on Windows. Strange situation.