• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Nov 19, 2024 Nov 19, 2024

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

 

rajiv_9638_0-1732010851060.png

 

TOPICS
Scripting

Views

75

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

In this line:

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

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

It doesn't work either with var.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines