Copy link to clipboard
Copied
How can I get the relevant text? (same question applies to other comment types -- replace and delete.)
I suspected commentPathGeometry -- but that just returns object no longer exists
myDoc=app.activeDocument;
i=278; // random comment -- it's underlined
c=myDoc.pdfComments;
$.writeln(c.commentType); // returns correct type
$.writeln(c.commentContent); // content is blank
$.writeln(c.commentPathGeometry); // crashes here
Thanks
Thanks.
Hm. Just tried explicitely this commenting type, but there is no way to show the comments on the page:
From Acrobat Pro:
Comments imported. No widget on the page:
Properties of comments:
0 commentReviewer ADMIN
0 commentContent
0 commentDate Wed Nov 14 2018 17:10:46 GMT+0100
0 commentType SQUIGGLY_TEXT_TYPE
0 commentFilePath F:\…\UnderlineCommentImported-CC-2019-14.0.1.209-Commented.pdf
0 commentPathGeometry Die angeforderte Aktion konnte nicht ausgeführt werde
...Copy link to clipboard
Copied
Hi akiva_atwood ,
I guess that some properties are not available with certain types of comments.
What will a code snippet like the one below reveal?
var doc = app.documents[0];
var pdfCommentsArray = doc.pdfComments.everyItem().getElements();
var pdfCommentsArrayLength = pdfCommentsArray.length;
for( var n=0; n<pdfCommentsArrayLength; n++ )
{
for( x in pdfCommentsArray
) {
try
{
$.writeln( n +"\t"+ x +"\t"+ pdfCommentsArray
.toString() ); }catch(e){ n +"\t"+ x +"\t"+ e.message }
}
};
Regards,
Uwe
Copy link to clipboard
Copied
Hi Uwe
I ran it for 5 comments to save time (getting the index takes a while):
275 commentReviewer משפחה
275 commentContent a
275 commentDate Thu Oct 25 2018 07:54:19 GMT+0300
275 commentType REPLACE_TEXT_TYPE
275 commentFilePath Macintosh HD:Users:akivaatwood:Documents:Documents - Akiva’s MacBook Air:books:Current Book Projects:Soskil:2019.pdf
275 commentStatus OPEN_STATUS
275 commentIsOrphan false
275 commentIsApplied false
275 id 11950
275 label
275 name
275 isValid true
275 parent [object Document]
275 index 275
275 properties [object Object]
275 events [object Events]
275 eventListeners [object EventListeners]
275 replies [object Replies]
275 isValid true
276 commentReviewer משפחה
276 commentContent
276 commentDate Thu Oct 25 2018 07:54:24 GMT+0300
276 commentType UNDERLINE_TEXT_TYPE
276 commentFilePath Macintosh HD:Users:akivaatwood:Documents:Documents - Akiva’s MacBook Air:books:Current Book Projects:Soskil:2019.pdf
276 commentStatus OPEN_STATUS
276 commentIsOrphan false
276 id 11958
276 label
276 name
276 isValid true
276 parent [object Document]
276 index 276
276 properties [object Object]
276 events [object Events]
276 eventListeners [object EventListeners]
276 replies [object Replies]
276 isValid true
277 commentReviewer משפחה
277 commentContent h
277 commentDate Thu Oct 25 2018 07:54:29 GMT+0300
277 commentType INSERT_TEXT_TYPE
277 commentFilePath Macintosh HD:Users:akivaatwood:Documents:Documents - Akiva’s MacBook Air:books:Current Book Projects:Soskil:2019.pdf
277 commentStatus OPEN_STATUS
277 commentIsOrphan false
277 commentIsApplied false
277 id 11971
277 label
277 name
277 isValid true
277 parent [object Document]
277 index 277
277 properties [object Object]
277 events [object Events]
277 eventListeners [object EventListeners]
277 replies [object Replies]
277 isValid true
278 commentReviewer משפחה
278 commentContent
278 commentDate Thu Oct 25 2018 07:54:35 GMT+0300
278 commentType UNDERLINE_TEXT_TYPE
278 commentFilePath Macintosh HD:Users:akivaatwood:Documents:Documents - Akiva’s MacBook Air:books:Current Book Projects:Soskil:2019.pdf
278 commentStatus OPEN_STATUS
278 commentIsOrphan false
278 id 11956
278 label
278 name
278 isValid true
278 parent [object Document]
278 index 278
278 properties [object Object]
278 events [object Events]
278 eventListeners [object EventListeners]
278 replies [object Replies]
278 isValid true
279 commentReviewer משפחה
279 commentContent
279 commentDate Thu Oct 25 2018 07:54:39 GMT+0300
279 commentType UNDERLINE_TEXT_TYPE
279 commentFilePath Macintosh HD:Users:akivaatwood:Documents:Documents - Akiva’s MacBook Air:books:Current Book Projects:Soskil:2019.pdf
279 commentStatus OPEN_STATUS
279 commentIsOrphan false
279 id 11948
279 label
279 name
279 isValid true
279 parent [object Document]
279 index 279
279 properties [object Object]
279 events [object Events]
279 eventListeners [object EventListeners]
279 replies [object Replies]
279 isValid true
Copy link to clipboard
Copied
isValid seems to be repeated -- and there's no "commentPathGeometry" value
ID obviously can extract the selected text of the document from the comment -- and select the text referenced in the document.
commentPathGeometry is SUPPOSED to be an array with
Ordered array containing pathPointArray:Array of Ordered array containing anchor:Array of 2 Reals, leftDirection:Array of 2 Reals, rightDirection:Array of 2 Reals, pathOpen:Boolean.
which seems to be the only possible property that could be used to identify the text commented on.
Copy link to clipboard
Copied
Hi,
I suppose that commentPathGeometry is an unfinished property ?!
Or a plain bug.
Did a new attempt with the following snippet that first collects all the results and then writes them to the JavaScript Console of the ESTK:
var doc = app.documents[0];
var pdfCommentsArray = doc.pdfComments.everyItem().getElements();
var pdfCommentsArrayLength = pdfCommentsArray.length;
var resultArray = [];
for( var n=0; n<pdfCommentsArrayLength; n++ )
{
for( x in pdfCommentsArray
) {
try
{
resultArray[resultArray.length++] = n +"\t"+ x +"\t"+ pdfCommentsArray
.toString() ; }catch(e)
{
resultArray[resultArray.length++] = n +"\t"+ x +"\t"+ e.message ;
};
};
};
var resultString = resultArray.join("\r");
$.writeln( resultString );
Now I can see property commentPathGeometry, but without a reasonable value; instead I had an error:
$ID/ObjectDeletedError
The German message is reading:
"Die angeforderte Aktion konnte nicht ausgeführt werden, da das Objekt nicht mehr existiert."
Translated to something like that:
"The requested action could not be accomplished, because the object does not exist anymore."
Regards,
Uwe
Copy link to clipboard
Copied
That's the exact error I get.
And that's the only property I can find that would (theoretically) let a script access the document...
Copy link to clipboard
Copied
Or we still did not find the right type of pdfComment where commentPathGeometry has a meaning.
Ah! Yep.There is one:
If you do a comment with the Pen Tool in Acrobat Pro DC commentPathGeometry gets an array of path point coordinates and a second boolean value, in my case set to true, because the path is open.
Something like that:
-89.2107089176879,132.560756273963,-89.2107089176879,132.560756273963,-85.514206232141,132.560756273963,-80.7967074528441,123.445674486854,-83.1674044743285,125.138972826697,-79.3483126774535,122.41106755326,-75.8886263981566,121.342158861854,-76.6847079411254,122.9341693599,-75.5751193180785,120.715083666541,-75.8886263981566,119.238673754432,-76.3844149723754,119.73446232865,-74.2445223942504,117.594569750525,-68.1759188786254,117.135158129432,-70.342819513391,117.7261615474,-60.7022250309691,115.096980639197,-62.5666049137816,114.330562182166,-64.649704279016,116.413783617713,-60.8729098454222,112.636867113807,-51.3480075016722,115.732875414588,-52.5531161442504,115.732875414588,-51.3480075016722,115.732875414588,true
An array of arrays.
Regards,
Uwe
Copy link to clipboard
Copied
Forgot:
commentType is: FREEFORM_DRAWING_TYPE
Regards,
Uwe
Copy link to clipboard
Copied
Interesting.
Is it possible pdfComment has other properties that aren't available?
parent would be the obvious way but that just gives the document, not the story/selected text, etc
Copy link to clipboard
Copied
I would do an extensive test with all types of comments available with Acrobat Pro DC and inspect the values after import to the PDF Comments panel of an InDesign document.
FWIW: commentPathGeometry should never crash InDesign with e.g. UNDERLINE_TEXT_TYPE.
That's a bug, I think.
Regards,
Uwe
Copy link to clipboard
Copied
I meant it crashes the script (unless there's a try/catch)
I need to specifically deal with UNDERLINE -- in order to Italicize the relevant text --
But I'll try other types just to see if I can figure out what's happening
Thanks
Akiva
Copy link to clipboard
Copied
Hi Akiva,
I think there is no way to determine the position of a comment widget on the page.
Not with scripting.
Regards,
Uwe
Copy link to clipboard
Copied
if there's no way then pdfComments is useless.
Copy link to clipboard
Copied
akiva_atwood wrote
if there's no way then pdfComments is useless.
Oh. I wouldn't say this.
What exactly did you hope to do with pdfComments?
Regards,
Uwe
Copy link to clipboard
Copied
change underlined text to italics (underlining is the standard way of marking up PDFs by editors)
Copy link to clipboard
Copied
Thanks.
Hm. Just tried explicitely this commenting type, but there is no way to show the comments on the page:
From Acrobat Pro:
Comments imported. No widget on the page:
Properties of comments:
0 commentReviewer ADMIN
0 commentContent
0 commentDate Wed Nov 14 2018 17:10:46 GMT+0100
0 commentType SQUIGGLY_TEXT_TYPE
0 commentFilePath F:\…\UnderlineCommentImported-CC-2019-14.0.1.209-Commented.pdf
0 commentPathGeometry Die angeforderte Aktion konnte nicht ausgeführt werden, da das Objekt nicht mehr existiert.
0 commentStatus OPEN_STATUS
0 commentIsOrphan true
0 commentIsApplied Die angeforderte Aktion konnte nicht ausgeführt werden, da das Objekt nicht mehr existiert.
0 id 248
0 label
0 name
0 isValid true
0 parent [object Document]
0 index 0
0 properties [object Object]
0 events [object Events]
0 eventListeners [object EventListeners]
0 replies [object Replies]
0 isValid true
1 commentReviewer ADMIN
1 commentContent
1 commentDate Wed Nov 14 2018 17:15:34 GMT+0100
1 commentType SQUIGGLY_TEXT_TYPE
1 commentFilePath F:\…\UnderlineCommentImported-CC-2019-14.0.1.209-Commented.pdf
1 commentPathGeometry Die angeforderte Aktion konnte nicht ausgeführt werden, da das Objekt nicht mehr existiert.
1 commentStatus OPEN_STATUS
1 commentIsOrphan true
1 commentIsApplied Die angeforderte Aktion konnte nicht ausgeführt werden, da das Objekt nicht mehr existiert.
1 id 250
1 label
1 name
1 isValid true
1 parent [object Document]
1 index 1
1 properties [object Object]
1 events [object Events]
1 eventListeners [object EventListeners]
1 replies [object Replies]
1 isValid true
Sigh. I'll file a bug report on this.
Regards,
Uwe
Copy link to clipboard
Copied
In ID there should be a green underline (There is on my mac)
And when you select the comment in the panel the related text is selected
Thanks
Akiva
Copy link to clipboard
Copied
Any idea why isValid is duplicated in the properties? Also a bug?
Copy link to clipboard
Copied
No. You'll find isValid two times with a lot of ( every? ) object in the DOM.
Hm. You mentioned color green for underline. Could be that I customized the color with my Acrobat Pro DC. And that could be the cause that InDesign CC 2019 is not showing the widgets. Just a guess…
Regards,
Uwe
Copy link to clipboard
Copied
Question> pdfComment.properties returns an object
Any way to find out what's in that object?
Copy link to clipboard
Copied
You can try method toSource().
That would better show how the value of commentPathGeometry is structured as array.
But I was not able to get the enumeration value for e.g. commentType.
commentType:({})
The thing that works better is the for( x in object ) method.
commentType FREEFORM_DRAWING_TYPE
Regards,
Uwe
Copy link to clipboard
Copied
FDF file is required:
More play with margins is needed.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now