Skip to main content
Participant
Nov 19, 2024 10:10 AM UTC
Question

Fetch comments, geometry on which comment is applied, giving error [the object no longer exists]

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);
          }
        }
      }

 

 

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Peter Kahrel
Community Expert
Community Expert
Nov 20, 2024 3:51 PM UTC

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.

Translate
Participant
Nov 20, 2024 5:36 AM UTC

It doesn't work either with var.

Translate
Peter Kahrel
Community Expert
Community Expert
Nov 19, 2024 10:28 AM UTC

In this line:

const comment = doc.pdfComments.item(i);

should const not be a var (or a let)?

 

Translate